Блог пользователя fanache99

Автор fanache99, история, 4 года назад, По-английски

Solutions to E, H, I, K anyone?

  • Проголосовать: нравится
  • +65
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится +48 Проголосовать: не нравится

Here's the official tutorial by tourist.

»
4 года назад, скрыть # |
 
Проголосовать: нравится +49 Проголосовать: не нравится

The editorial of C tells us to find $$$(1+x+x^2)^k$$$ using "binary exponentiation and FFT". It may be understood as "multiply the polynomial by itself about log times", but in fact one can do fft, then $$$x \mapsto x^k$$$, then inverse fft. Though it still requires binary exponentiation, I believe that it should be faster than binary polynomial exponentiation (though it is kinda the same asymptotically).

»
4 года назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

E: In the tree you can solve with two phases of DP. First, you count the number of reachable vertices in subtree (in bottom-up order), Second, you count the number of reachable vertices not in subtree (in top-down order) with help of the first computed values. In the cactus you just do the same thing. At least it's easier to write than B.

K: Do binary search, compute the min/max number of possible zeroes with DP (+ deques to optimize). If the desired number of zeroes fits into the interval, then the answer exists. I didn't prove it, but if you believe it, then you can just backtrack the DP to find the answer.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In editorial of F there is a small typo: $$$f(l, r) = 2f(\lfloor l/2 \rfloor, \lfloor r/2 \rfloor) + (l\%2)$$$