# LOJ#6074 「2017 山东一轮集训 Day6」

$dp_{i,j}=\begin{cases}dp_{i-1,j} \text{ if } j \ne S_i \\\sum_{k=0}^{m} dp_{i-1,k} \text{ if }j=S_i \end{cases}$

\begin{aligned}M_i = \begin{pmatrix}1 & & 1 & & \\ & 1 & 1 & & \\ & & 1 & & \\ & & \vdots & \ddots & \\ & & 1 & & 1 \end{pmatrix} \\\\ F_i &= F_{i-1}M_i \end{aligned}

$M_i$ 是一个主对角线为 (1)，$S_i$ 这一列为 (1)，其余为 (0) 的矩阵。

$B=\begin{pmatrix}1 \\ 1 \\ 1 \\ \vdots \\ 1 \end{pmatrix}$

\begin{aligned}ans&=AM_lM_{l+1}M_{l+2}\cdots M_{r}B\\&=AM_{l-1}^{-1}M_{l-2}^{-1}\cdots M_1^{-1}M_1M_2\cdots M_{r}B\end{aligned}

\begin{aligned}CM_i&=\begin{pmatrix}C_{0,0} & C_{0,1} & C_{0,2} & \cdots & C_{0,m} \\ C_{1,0} & C_{1,1} & C_{1,2} & \cdots & C_{1,m} \\ C_{2,0} & C_{2,1} & C_{2,2} & \cdots & C_{2,m} \\ & & & \ddots & \\ C_{m,0} & C_{m,1} & C_{m,2} & \cdots & C_{m,m} \end{pmatrix}\begin{pmatrix}1 & & 1 & & \\ & 1 & 1 & & \\ & & 1 & & \\ & & \vdots & \ddots & \\ & & 1 & & 1 \end{pmatrix} \\ &= \begin{pmatrix}C_{0,0} & C_{0,1} & \sum_{j=0}^m C_{0,j} & \cdots & C_{0,m} \\ C_{1,0} & C_{1,1} & \sum_{j=0}^m C_{1,j} & \cdots & C_{1,m} \\ C_{2,0} & C_{2,1} & \sum_{j=0}^m C_{2,j} & \cdots & C_{2,m} \\ & & & \ddots & \\ C_{m,0} & C_{m,1} & \sum_{j=0}^m C_{m,j} & \cdots & C_{m,m} \end{pmatrix}\end{aligned}

$M_i^{-1}=\begin{pmatrix}1 & & -1 & & \\ & 1 & -1 & & \\ & & 1 & & \\ & & \vdots & \ddots & \\ & & -1 & & 1 \end{pmatrix}$

$M_i^{-1}$ 是主对角线为 $1$，第 $S_i$ 列除了第 $S_i$ 行外是 $-1$ 的矩阵。

\begin{aligned}M_i^{-1}C&=\begin{pmatrix}1 & & -1 & & \\ & 1 & -1 & & \\ & & 1 & & \\ & & \vdots & \ddots & \\ & & -1 & & 1 \end{pmatrix}\begin{pmatrix}C_{0,0} & C_{0,1} & C_{0,2} & \cdots & C_{0,m} \\ C_{1,0} & C_{1,1} & C_{1,2} & \cdots & C_{1,m} \\ C_{2,0} & C_{2,1} & C_{2,2} & \cdots & C_{2,m} \\ & & & \ddots & \\ C_{m,0} & C_{m,1} & C_{m,2} & \cdots & C_{m,m} \end{pmatrix} \\ &= \begin{pmatrix}C_{0,0}-C_{2,0} & C_{0,1}-C_{2,1} & C_{0,2}-C_{2,2} & \cdots & C_{0,m}-C_{2,m} \\ C_{1,0}-C_{2,0} & C_{1,1}-C_{2,1} & C_{1,2}-C_{2,2} & \cdots & C_{1,m}-C_{2,m} \\ C_{2,0} & C_{2,1} & C_{2,2} & \cdots & C_{2,m} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ C_{m,0}-C_{2,0} & C_{m,1}-C_{2,1} & C_{m,2}-C_{2,2} & \cdots & C_{m,m}-C_{2,m} \end{pmatrix}\end{aligned}

$\begin{pmatrix}x_0-v \\ x_1-v \\ x_2-v \\ \vdots \\ x_m-v \end{pmatrix}$

$\begin{pmatrix}x_0-v-(x_2-v) \\ x_1-v-(x_2-v) \\ x_2-v \\ \vdots \\ x_m-v-(x_2-v) \end{pmatrix}=\begin{pmatrix}x_0-x_2 \\ x_1-x_2 \\ (2x_2-v)-x_2 \\ \vdots \\ x_m-x_2 \end{pmatrix}$

$\begin{pmatrix}0 & 0 & 0 & \cdots & 0 & 1 \end{pmatrix}$

posted @ 2020-12-11 21:39  Hs-black  阅读(117)  评论(2编辑  收藏  举报