We will hold Exawizards Programming Contest 2021(AtCoder Beginner Contest 222).
- Contest URL: https://atcoder.jp/contests/abc222
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20211009T2100&p1=248
- Duration: 100 minutes
- Number of Tasks: 8
- Writer: kyopro_friends, Nyaan, physics0523
- Tester: sugarrr
- Rated range: ~ 1999
The point values will be 100-200-300-400-500-500-600-600.
We are looking forward to your participation!
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.I have been trying from 30 mins to understand the problem C itself....
PS: Still haven't understood the question
I did not read carefully which letters are used for the three options, and used the usual RSP instead.
i don't know how to explain cause i also didn't understand it well but:
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.
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
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.
Neat trick! Will keep this in mind for similar problems. Thanks!
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?
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.
E was the best problem and fact-based problem I have ever seen Thanks :))
How can the overall complexity for E be $$$O(NK)$$$ if N=10^3, K=10^5?
I think k won't exceed 999 because n<=1000
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
Removed because apparently I can't math properly.
No, K = (M-1)(N-1). You can check this by imagining M=1 (or M=2)
Even so,if your program's constant is'nt large,it's fast enough on overwhelming majority machine.
Thanks for the great contest! Problems are really nice, enjoy it :)
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.
F is tree re-rooting i guess
That's one approach, yes. I did something similar to the diameter solution explained in the editorial.
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
Also I have seen problems like E before, you can try this one if you haven't already solved https://codeforces.net/contest/1381/problem/B
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/26610243
I think I have used the same concept as editorial, but still it is not working for me, however it runs over the sample cases...
how to solve D?
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.
Are there any good article about rerooting DP like: the article written by ei13333, but in English?
Thanks in advance!!
How to solve G ?
I am getting runtime errors in 3 cases for my submission for problem E. Can someone tell me where is the problem.
Did you consider the case when everything in the array
M
is equal? Eg:Answer should be 2 here.
This is the biggest miss on a corner case I ever had, thanks for the test case man!!!
Thanx for the test case dude.
Can we solve problem D with recursive DP in O(N*M)?
This contest proved that I have serious weakness in dp
TLE on D. How to solve it in O(NM)?
using cumalative sum idea. at any position you need a range (current value to next state highest value ) so you can precalculate before .
Hey can you explain the base case dp[0][0] = 1. Is it due to the fact its empty sequence or something else?
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.
Can you please explain your solution in detail? I can't get the idea.