We will hold AtCoder Grand Contest 065. This contest counts for GP30 scores.
- Contest URL: https://atcoder.jp/contests/agc065
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20231217T2100&p1=248
- Duration: 180 minutes
- Number of Tasks: 6
- Writer: PCTprobability, chinerist
- Tester: HIR180
- Rated range: 1200 -
The point values will be 500-700-900-900-1500-1600.
We are looking forward to your participation!
A with 500 points? Seems a tough round.
Thanks for the contest! ABCE are amazing, but D is just this link, which is super frustrating...
Ohh damn, that explains why 2-3 very not really high rated folks solved D.
I'm sorry, I completely overlooked this one. Actually, the intended solution does not involve this interpretation and I thought it wasn't known. I'll try to be more careful when setting a problem like this.
Anyway, thanks for participating in the contest and I'm glad you liked other problems.
Thanks for yet another great round!
Assuming the intended solution in the one from the editorial, why is this problem only worth 900 points? It would seem closer in difficulty to E and F than to C with that solution :)
Actually, the latter half of the intended solution (after the "it can be rephrased as follows:" line in the editorial) is a famous problem. For example, I can remember the same technique was used in the problem A in the Stage 7 of the UCUP this season. Therefore I thought it would not be as hard as E and F.
In addition, testers solved the problem without great difficulty. They said it wouldn't be hard for those who are familiar with formal power series, and C and D were of a similar difficulty. This is how we chose the score of 900.
I'd also say it's not very hard for people familiar with formal power series, though I used a completely different approach from the editorial. Describing the answer using coefficients of closed form is straightforward with only difficulty coming from algebraic mistakes, expanding that into series is a bit trickier since you can choose to expand in an ugly way, but you can try multiple things there.
Basically if the OGF of choosing $$$m$$$ segments inside a slice containing $$$n$$$ unused points (the segment that would cut off this slice can't be chosen) is $$$f(x,y) [x^m y^n]$$$, then the answer is $$$f^2(x,y) [x^{N-2} y^{M-1}] \frac{N}{2M}$$$. A bit of combinatorics gives
and the square root can be expanded using Taylor series for square root. This is where things can get ugly, but it gets much nicer if we take $z = y(1+x)$ and bring $$$1-z$$$ outside the square root before expanding $$$\sqrt{1-4xz/(1-z)^2}$$$:
Then we take just the terms containing $z^{N-2}$, expand $$$(1+x)^{N-2}$$$ in them to pick the right coefficients for $$$x^{M-1}$$$ in total and we're done. It's work but doesn't require a stroke of genius, I think I could've switched solving C for D and gotten around the same result.
Did anyone manage to solve D in-contest without referring to external resources? If so, did you do it in a simpler way than the editorial?
I didn't attend the contest. However, if we write down the generating function $$$F(x,y)=\sum\limits_{n,m}f(n,m)x^ny^m$$$ we can get that $$$F$$$ is the root of some quadratic polynomial. By solving this directly and expanding the square root with another power series we may get the same sum of binomial coefficients as in the tutorial.
Would you mind sharing a full derivation? I got
where the answer is
But when I tried expanding the square root I ended up with a quadratic rather than a linear number of terms. I'm getting the correct answers for small $N$ and $$$M$$$ so it must be equivalent to the editorial somehow ...
UPDATE: It works out if you rewrite the square root as
where $$$c=a(1+b)$$$, as Xellos did above.
I'm not sure if it's easier, but I decided this way at the contest: Let's consider the points in the order 1,2,..., n. At each moment of time (let's say the $$$i$$$-th) we will have a set of "available" points, i.e. those that have a number less than $$$i$$$, and we can draw an edge from $$$i$$$ into them. Then adding a point first deactivates some points, and then it becomes active itself. Let's draw a closing bracket for deactivation, and an opening bracket for activation.
Let's say that when adding a point, we drew an edge into the $$$j$$$-th ($$$j<i$$$), and $$$j$$$ is the minimal such number. Then all points between i and j will be deactivated regardless of the edges between them. That is, in terms of the generating function, the closing bracket multiplies by $$$(1+x)$$$, and sometimes we also need to multiply by $$$x$$$ if we deactivate at least 1 vertex, in the opposite case by $$$(1+x)$$$. If you calculate everything carefully, you get a sum of type $$$C_px^a(1+x)^b$$$, where $$$C_p$$$ is the number of parenthesis sequences with $$$p$$$ pairs of adjacent opening brackets, which can be calculated explicitely, and $$$a,b$$$ depends on $$$p$$$. So $$$m$$$-th coefficient is just the sum of linear size.
To calculate $$$C_p$$$, do you need to use the same method as the editorial uses to compute $$$G_k$$$?
These numbers even have a Wiki page https://en.wikipedia.org/wiki/Narayana_number. Yea, they may be calculated with same method (or, for example, by repeating the proof for Catalan numbers formula via cyclic shifts).
Problem D
I'm sorry again. Of course I checked OEIS before setting the problem, but this sequence didn't show up when I made a search.
The trick is that the OEIS table only contains values for $$$M \leq N$$$ and that deceived me. I need to study how to use OEIS...
anyone solved A differently than editorial?
Can anyone please explain problem A's construction for c = c' — 1 please? I couldn't understand the editorial for this case's construction!
The thing is we will first look at the set of elements which have max. frequency , if there is only one element which has max. frequency then it can be placed at both ends acheiving c * k as the answer. if there are more than one such elements( we will represent them by v) then say x is minimum of them and y is max. then using c , the max. possible is x — y + c * k . However we may achieve a better answer by trying to adjust first and last elements but by making c' = c — 1. At c' we can make leftmost element as v[i] and rightmost as v[i+1] achieving answer as v[i+1] — v[i] + k * c'.
For the array A = (8,5,2,2,4,4), c = 4.
Now for c'= 3, isn't this the best construction? (5,4,2,4,2,8). This is not among the v[i+1]-v[i] cases you mentioned at the last right?
you can do more better for c' = 3 , (4, 2 , 5 , 4, 2 , 8). But the thing is in this case c = 4 is the best we can , in the cases where c = max. is not the best it can be shown v[i+1]-v[i] thing yields the best answer.
Can anyone explain their solution for A? I find the editorial a bit hard to understand.
There seems to be a clerical error in E's editorial.
In the case of x<z<y, maybe the last formula should be reverse(y+1,n,1,3,1,2).
And in F's Editorial, the subscript of second formula of [2] should be k.