Competition is over. Is there any editorial available?
How to solve A, B, F?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Name |
---|
Our solution for problem B was an attempt to generalize Fermat Little Theorem over polynomials, but we still don't have any proof about why it works?
$$$ (x^i+1)^{\text{mod}}=x^{i \text{mod}}+1 $$$ and since $$$ \text{mod} $$$ is a prime when modulo $$$ n $$$ we have $$$ \prod_{i=0}^{n-1} (x^i+1)^{\text{mod}} = \prod_{i=0}^{n-1} (x^i+1) $$$, and we can reduce $$$ T $$$ by this formula.
Has anybody got WA20 in L? What can be the reason of it?
We got WA5 because we did initially all computations mod 998244353, but that was a case hacking this mod. After changing the mod to a more unusual, still FFT friendly, prime we got AC. Are you doing all computation with reals, or using mod?
I tried to solve it without FFT, and more expected to have TL, not WA :)
UPD: found a bug, now getting TL, never mind.
UPD2: solution without FFT, just two BFS, gets AC (3.084s): https://pastebin.com/wWjVknQM
After every multiplication you can "normalize" the polynomial with
p[i] = min(1, p[i])
. Then every coefficient after multiplication is at most p.size() and I believe any mod or floating-point works fine.got TL 5. Used floating point fft
got AC 1.6s using fft with doubles in c++. We only have two optimizations: we precomputed the roots of unity and we did two ffts calls for every multiplication instead of three(item 16)
We didn't get WA5 with mod 998244353; what we did is NTT, then take every number in the result to the power of l(or r-l, depending on which polynomial we're exponentiating) and then inverse NTT.
Can you provide the formula you were using? I don't see any difference between solutions, yet you say that you had no problems with modulo.
Editorial
F: if $$$s_b > s_p$$$ you can always win (by throwing far enough)
if $$$s_b = s_p$$$ you can always win, unless opponent is between you and your teammate
The main case is $$$s_b < s_p$$$. Draw a Perpendicular Bisector between teammate and the opponent. If you are able to send the ball to this line so that it's not intercepted, your teammate will be here faster. So, you then get a quadratic equation and the sign of its discriminant determines the answer
Everyting can be done in integers(rationals)
You can also construct an apollonian circle and check if this circle intersects the perpendicular bisector.
Anyone have solution code for E and H?
yes, why?
Nice tests in F (not a sarcasm), I wouldn't expect it was possible to fail $$$\varepsilon=10^{-8}$$$ within coordinates up to 75. If not for them I would have gotten AC within first hour :v
By the way it is possible to solve problem I in $$$O(n^3)$$$ even modulo anything instead of modulo 2. I actually think that is an easier solution than trick from editorial. Last cycle is either a loop (in that case we take answer from dp[n-1][k]) or it contains $$$n$$$ and $$$c$$$ for some number $$$c$$$ and it adds $$$2n-2c-1$$$ inversions, so we take answer from dp[n-2][k-2n+2c+1] then.
Actually, this exact DP can be found at OEIS: http://oeis.org/A213910
This is what I did as well. Since we are only interested in the parity of the answer, we could further use bitsets to calculate it in $$$O(n^3 / log\ n)$$$.
EDIT: should have thought it through, calculating DP is indeed easy given the previous DP and prefix sum as bitsets, but I don't see how we can calculate the new prefix sums using bitsets >_>
How do you use bitsets for this?
If I understand correctly, we can calculate all dp[n][] using prefix sums sumdp of odd/even diagonals in one go: (sumdp[n — 1][] << 1) ^ dp[n — 1][].
My bad, didn't think it through :/
What's test 7 on C?
N = 1, answer should be 2.
............ :ultimate_facepalm:
Stress tested with everything except $$$n = 1$$$. And that's the only case where my solution fails.