# SDOI2019 集训 小孩召开法 题解

### 小孩召开法

PS：我也不知道这比赛叫啥。

$a_k(n)$ 为答案，有

$a_k(n)=\sum_{j=0}^n \binom nj \sum_{2r+s=k-1} (a_{2r}(j)+a_{2r+1}(j))a_s(n-j)$

$F_k(x)$$a_k(x)$ 的 EGF，式子可以化为

$F_k'(x)=\sum_{2r+s=k-1}(F_{2r}(x)+F_{2r+1}(x))F_s(x)$

$A(x,t)=\sum_{n,k\geq 0} a_k(n)\frac {x^n}{n!}t^k$$A_1(x,t)=\sum_{k\geq 0}F_{2k}(x)t^{2k}$$A_2(x,t)=\sum_{k\geq 0}F_{2k+1}(x)t^{2k+1}$，有

$A_1(x,t)=\frac 12(A(x,t)+A(x,-t)) \qquad A_2(x,t)=\frac 12(A(x,t)-A(x,-t))$

$\frac {\partial A(x,t)}{\partial x}=\frac {t+1}4(A^2(x,t)+A^2(x,-t)) \qquad \frac {\partial A(x,-t)}{\partial x}=\frac {t+1}4A(x,t)A(x,-t)$

$\frac {\partial A_1}{\partial x} = tA_1A_2+A_1^2 \qquad \frac {\partial A_2}{\partial x}=tA_1^2+A_1A_2$

$\frac {\partial(A_1^2-A_2^2)}{\partial x}=0$

$A_1^2(x,t)-A_2^2(x,t)=1$

$b_k(x)=\sum_{j\leq k}a_k(x)$$B_k$ 为其 EGF，解一下可得

$A(x,t)=(1-t)B(x,t) \qquad B(x,t)= \frac {\frac 2\rho}{1-\frac {1-\rho}te^{\rho x}} - \frac 1{\sqrt{1-t^2}}$

$\frac {\partial A}{\partial x} = (tA_1+A_2)(A_1+A_2)=\frac 12 (tA+\frac tA+A-\frac 1A)$

\begin{aligned} &\frac {\partial A}{A((t+1)A+\frac {t-1}A)} = \frac{\partial x}2 = \frac {\partial B}{(1-t^2)B^2-1} \\ &\partial(\rho B)(\frac 1{\rho B -1}-\frac 1{\rho B+1}) = \rho \partial x \\ &\log \frac {\rho B-1}{\rho B+1}=\rho x +C(t) \end{aligned}

$\frac {\rho B-1}{\rho B+1} = C(t)e^{\rho x} \Rightarrow B =\frac {1+C(t)e^{\rho x}}{\rho(1-C(t)e^{\rho x})}$

$C(t)=\frac {\frac {\rho}{1-t}-1}{\frac {\rho}{1-t}+1}$

$b_k(n)=\frac 1{2^k-1}\sum_{r+2s\leq k,r\equiv k \pmod 2} (-2)^s \binom {k-s}{\frac {k+r}2}\binom ns r^n$

\begin{aligned} B(x,t) &= \frac 2{\rho}\left(1-\frac{1-\rho}te^{\rho x}\right)^{-1} \\ &= \frac 2{\rho} \sum_r\left(\frac{1-\rho}te^{\rho x}\right)^re^{-r(1-\rho)x} \\ &= \frac 2{\rho} \sum_r\left(\frac{1-\rho}te^{\rho x}\right)^r \sum_s \frac{(-r(1-\rho)x)^s}{s!} \\ &= \frac 2{\rho} \sum_{r,s\geq 0} \left(\frac t2\right)^r \frac {(-rt^2\frac x2)^s}{s!}e^{rx}\left(\frac {2-2\rho}{t^2}\right)^{r+s} \\ &= 2\sum_{r,s\geq 0} \left(\frac t2\right)^r \frac {(-rt^2\frac x2)^s}{s!} \left[\sum_l\binom {r+s+2l}l\left(\frac {t^2}4\right)^l\right]\left[\sum_m\frac {(rx)^m}{m!}\right] \\ &= \sum_{r,s,l,m}(-1)^s2^{1-r-s-2l}\binom {r+s+2l}{r+s+l}\binom {s+m}s r^{s+m}t^{r+2s+2l} \binom {s+m}s r^{s+m}t^{r+2s+2l}\frac {x^{s+m}}{(s+m)!} \end{aligned}

$n=s+m$$k=r+2s+2l$ 即可。

$\left(\frac {2-2\rho}{t^2}\right)^n=\sum_i\binom {n+2i}i\left(\frac {t^2}4\right)^i$

$\frac 1{\sqrt{1-4x}}\left(\frac {1-\sqrt{1-4x}}{2x}\right)^m = \sum_{i=0}^\infty \binom {n+2i}i x^i$

$g_k (x) = \sum_s(-2)^s \binom ns \binom {k-s}x$

$g_k(x)=-\frac 1x((2n-x)g_k(x-1)+(k-x+2)g_k(x-2)$

$n=k$ 时显然，由 $g_k (x) = g_{k−1}(x − 1) + g_{k−1}(x)$归纳即可。

$O(k)$ 递推 $g_k$，计算快速幂即可，时间复杂度 $O(k \log n)$$O(k)$

posted @ 2020-05-13 21:56  disangan233  阅读(907)  评论(0编辑  收藏  举报
Live2D