[Explanations] CTS2019 Pearl (+ binomial inversion convolution)

[Explanations] CTS2019 Pearl

Subject is to satisfy such a condition \ (C_i \) representative of the number of occurrences
\ [\ sum {[\ dfrac
{c_i} 2]} \ ge 2m \] Obviously \ (\ sum c_i = n \ ) Therefore, and if \ ( C_i \) is \ (2 \) divisor have normal contribution, if there is not less contribution, then
\ [\ sum ^ D_ {i = 1} {[2 \ mid c_i]}> n- 2M \]
provided \ (F_i \) to have Imperial \ (I \) colors even number of times in the scenario. Problem instantly became HAOI dyeing ...

There
\ [f_i = {D \ choose i} [x ^ n] n (\ dfrac {e ^ x + e ^ {- x}} {2})! ^ I {(e ^ x)} ^ {Di } \]
selected handpicked \ (I \) colors, followed by the sequence generation method.
\ [F_i = {D \ choose
i} [x ^ n] n ({e ^ x + e ^ {- x}})! ^ I {(e ^ x)} ^ {Di} \] expand \ (^ I \)
\ [F_i = {D \ the Choose I} [X ^ n-] n-! \ sum_ {J = 0} ^ I {I \ the Choose J} {(E ^ X)} ^ {D + 2J-2i} \]
because it is seeking \ ([x ^ n] \ ) so
\ [f_i = {D \ choose i} n! \ sum_ {j = 0} ^ i {i \ choose j} \ dfrac {{(D + 2j -2i)} ^ n} {n !} \]

\[ ={D\choose i}\sum_{j=0}^i{i\choose j} {{(D+2j-2i)}^n} \]

So
\ [\ dfrac {f_i} { ! {D \ choose i} i} = \ sum_ {j = 0} ^ i \ dfrac {(- (2i-2j-D)) ^ n} {j (ij)! !} \]
formula to get the right NTT directly.

However, we know that this King James is repeated, how to repeat specific reference [[explanations] HAOI2018] staining (NTT + inclusion and exclusion / binomial inversion) . We direct binomial inversion:

Set \ (G_i \) represents exactly \ (I \) color number of occurrences is even scheme, consider \ (G_J \) in (F_i \) \ number of occurrences of
\ [f_i = \ sum_ {j = i} ^ D {j \ choose i}
g_i \] directly binomial inversion
\ [g_i = \ sum_ {j
= i} ^ D (-1) ^ {ji} {j \ choose i} f_j \] subscript from 0 no problem, that alterations:
\ [G_i = \ sum_ {J} = 0 ^ D (-1) JI ^ {} \ J dfrac {!} I {(JI)!!} F_j \]
finishing
\ [\ dfrac G_i {} {!} I = \ sum_ {J} = 0 ^ D \ dfrac {(-. 1) JI ^ {} \ J F_j Times!} {(JI)!} \]
Reverse look right and direct NTT

The final answer:
\ [\ sum_ {i = the n-2M-D G_i + 1} ^ \]
You certainly can not do that, \ (the n-\ Le 1E9 \) ah, but considering some of the edge cases:

  • \ (n <2m \) answers 0
  • \ (n-2m + 1> D \) answer to \ (D ^ n \)

So if a polynomial algorithm that
\ [n \ ge2m \\ n-
2m + 1 \ le D = 1e5 \\ \] polynomial maxn open \ (1 << 18 \) on the line.

The code is really too lazy to write a condom board tone parameters.

Guess you like

Origin www.cnblogs.com/winlere/p/11247179.html