### chokudai's blog

By chokudai, history, 7 weeks ago,

We will hold Exawizards Programming Contest 2021（AtCoder Beginner Contest 222）.

The point values will be 100-200-300-400-500-500-600-600.

We are looking forward to your participation!

• +61

 » 7 weeks ago, # | ← Rev. 2 →   +25 Here's the screenshot of the contest page:I'm wondering why the color is orange when the rating is 1999? Shouldn't it be blue?Also, the point values of each problem hasn't announced yet. Is it a secret in this contest? Sorry my fault.
 » 7 weeks ago, # |   +4 I have been trying from 30 mins to understand the problem C itself....PS: Still haven't understood the question
•  » » 7 weeks ago, # ^ |   0 I did not read carefully which letters are used for the three options, and used the usual RSP instead.
•  » » 7 weeks ago, # ^ |   +3 i don't know how to explain cause i also didn't understand it well but:
•  » » 7 weeks ago, # ^ |   0 I believe the intention of this problem is having you deal with that somewhat counterintuitive memory access. A[i][j] gives the move (rock, paper or scissor) for the i-th player at the j-th round, but you have to keep track of which player is playing which player at each round.
•  » » 7 weeks ago, # ^ |   0 Output is the $id's$ sorted by their rankings decreasingly (bigger ranking -> more wins, or if same number of wins the smaller id gets the better rank).What you need to do is make a custom comparator for your rankings array and sort them for every match.I agree statement was bloated and implementation was not fun :(Submission
•  » » » 7 weeks ago, # ^ |   0 Instead of making comparator, we can also sort by inserting the score and id of participant as,(-score[i],i) into vector and sort it normally.
•  » » » » 7 weeks ago, # ^ | ← Rev. 2 →   +3 Neat trick! Will keep this in mind for similar problems. Thanks!
•  » » » » 7 weeks ago, # ^ |   0 I did that using a set of pairs. It works on sample test cases and other test cases, but other test cases fail. I don't even know why ...There is a good implementation here: https://atcoder.jp/contests/abc222/submissions/26443979
•  » » » » 7 weeks ago, # ^ |   0 Can you tell me how does this work? If we store the -ve of the score comes first?Isn't it the same like doing the reverse sorting with +ve score?
•  » » » » » 7 weeks ago, # ^ |   0 If you do reverse sorting then for same scores, the one with bigger id will come first, but in problem we want the one with smaller id to come first in case of tie.
 » 7 weeks ago, # |   +1 E was the best problem and fact-based problem I have ever seen Thanks :))
 » 7 weeks ago, # |   0 How can the overall complexity for E be $O(NK)$ if N=10^3, K=10^5?
•  » » 7 weeks ago, # ^ | ← Rev. 2 →   -8 I think k won't exceed 999 because n<=1000
•  » » » 7 weeks ago, # ^ |   0 Imagine a line of 1000 nodes, M = 100, A = [1, 1000, 1, 1000 ... ], if every edge is painted red, we have K is around 10^5
•  » » » » 7 weeks ago, # ^ | ← Rev. 2 →   0 Removed because apparently I can't math properly.
•  » » » » » 7 weeks ago, # ^ | ← Rev. 2 →   0 No, K = (M-1)(N-1). You can check this by imagining M=1 (or M=2)
•  » » 6 weeks ago, # ^ | ← Rev. 2 →   0 Even so,if your program's constant is'nt large,it's fast enough on overwhelming majority machine.
 » 7 weeks ago, # |   0 Thanks for the great contest! Problems are really nice, enjoy it :)
 » 7 weeks ago, # | ← Rev. 2 →   +4 E and F were really nice! even though I got 4 WA because I didn't initialize my arrays large enough on E and didn't learn my lesson for FI like how E combined two seemingly unrelated things: bfs/dfs through a tree and knapsack dp.For F, I think anything to do with adding virtual nodes is brilliant.
•  » » 7 weeks ago, # ^ |   +3 F is tree re-rooting i guess
•  » » » 7 weeks ago, # ^ |   0 That's one approach, yes. I did something similar to the diameter solution explained in the editorial.
•  » » 7 weeks ago, # ^ |   0 For F i used a very different but simpler approach. I just found out for every node, the maximum and second maximum cost if we were to start a path from that node. But looking at the intended solutions, I am skeptical about mine. Can someone hack my solution :(Link to my solution :- https://atcoder.jp/contests/abc222/submissions/26464480
•  » » 7 weeks ago, # ^ |   0 Also I have seen problems like E before, you can try this one if you haven't already solved https://codeforces.com/contest/1381/problem/B
•  » » 6 weeks ago, # ^ |   0 Can you pls help me to point out the error in my E solution? It's giving WAs consistently (tried nearly 10 times).My submission: https://atcoder.jp/contests/abc222/submissions/26610243I think I have used the same concept as editorial, but still it is not working for me, however it runs over the sample cases...
 » 7 weeks ago, # |   0 how to solve D?
•  » » 7 weeks ago, # ^ |   +3 I did DP with prefix sum.dp[i][x] = number of non decreasing sequences c[0]...c[i] with c[i]=x and a[j]<=c[j]<=b[j] for all j.
 » 7 weeks ago, # |   0 Are there any good article about rerooting DP like: the article written by ei13333, but in English?Thanks in advance!!
 » 7 weeks ago, # |   0 How to solve G ?
 » 7 weeks ago, # |   +1 I am getting runtime errors in 3 cases for my submission for problem E. Can someone tell me where is the problem.
•  » » 7 weeks ago, # ^ |   +7 Did you consider the case when everything in the array M is equal? Eg: 2 2 0 1 1 1 2 Answer should be 2 here.
•  » » » 7 weeks ago, # ^ |   +2 This is the biggest miss on a corner case I ever had, thanks for the test case man!!!
•  » » » 7 weeks ago, # ^ |   0 Thanx for the test case dude.
 » 7 weeks ago, # |   +4 Can we solve problem D with recursive DP in O(N*M)?
 » 7 weeks ago, # |   +10 This contest proved that I have serious weakness in dp
 » 7 weeks ago, # |   0 TLE on D. How to solve it in O(NM)?
•  » » 7 weeks ago, # ^ |   0 using cumalative sum idea. at any position you need a range (current value to next state highest value ) so you can precalculate before .
•  » » » 7 weeks ago, # ^ |   0 Hey can you explain the base case dp[0][0] = 1. Is it due to the fact its empty sequence or something else?
•  » » » » 7 weeks ago, # ^ |   0 We can instead count the number of sequences $c_i$ ($i = 0, 1, \ldots, N$) (note that it has $N+1$ elements) such that $c_0 = 0$, $c_i < c_{i+1}$ for all $i = 0, 1, \ldots, N-1$, and $a_i \leq c_i \leq b_i$ for all $i = 1, \ldots, N$. The numbers are identical.
•  » » » 7 weeks ago, # ^ |   0 Can you please explain your solution in detail? I can't get the idea.