2026.8.15 模拟赛

https://oj.gxyzh.com/d/hzoj/contest/68ea003832e9dbaccee4ffdc

T1 T2 T3 T4
实际得分 100 100 30 30
期望得分 100 100 30 50
能力得分 100 100 30~100 50~100

这场题没有区分度.

T1 是找规律,T2 是树剖板子(当然也可以使用神秘统计做到 \(O(1)\)),T3 是矩阵优化 DP,T4 是网络流(要将平面图转为对偶图).

滚动雪球问题

有显然的 30 分 DP:

\[dp_n=dp_{n-1}+dp_{\left \lfloor \frac{n}{2} \right \rfloor } \]

令 \(dp_1=1\),那么 \(dp_n\) 就是答案.

我们可以将边界修改为 \(dp_0=1\),那么 \(\frac{dp_n}2\) 就是答案,这一步方便后面的处理.

由于 \(n\le 10^{18}\),显然需要矩阵优化.

由于数论分块的经典结论:

\[\left \lfloor \frac{n}{4} \right \rfloor = \left \lfloor \frac{\left \lfloor \frac{n}{2} \right \rfloor }{2} \right \rfloor \]

因此我们可以将 $\left \lfloor \frac{n}{2^k} \right \rfloor $ 放在一起维护,有如下矩阵:

\[\begin{bmatrix} f_x \\ f_{\left \lfloor \frac{x}{2} \right \rfloor} \\ f_{\left \lfloor \frac{x}{4} \right \rfloor} \\ \dots\\ f_{\left \lfloor \frac{x}{2^k} \right \rfloor} \\ \end{bmatrix} \]

考虑从 \(x-1\) 向 \(x\) 转移(这样可以将 \(\operatorname{lowbit}\) 相同的放在一起处理).
记 \(\operatorname{bit}(x)=\log\operatorname{lowbit}(x)\).

现在我们要构造转移矩阵:

\[\begin{bmatrix} f_x \\ f_{\left \lfloor \frac{x}{2^1} \right \rfloor} \\ f_{\left \lfloor \frac{x}{2^2} \right \rfloor} \\ \dots\\ f_{\left \lfloor \frac{x}{2^k} \right \rfloor} \\ \end{bmatrix} =\begin{bmatrix} 1 & ? & ? & ? & ?\\ 0 & 1 & ? & ? & ?\\ 0 & 0 & 1 & ? & ?\\ 0 & 0 & 0 & 1 & ?\\ 0 & 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} f_{x-1} \\ f_{\left \lfloor \frac{x-1}{2} \right \rfloor} \\ f_{\left \lfloor \frac{x-1}{4} \right \rfloor} \\ \dots\\ f_{\left \lfloor \frac{x-1}{2^k} \right \rfloor} \\ \end{bmatrix} \]

显然,若 \(\left \lfloor \frac{x-1}{2^k} \right \rfloor=\left \lfloor \frac{x}{2^k} \right \rfloor\) 则直接转移,否则需要转移其他的 \(f\),转移长度就是 \(\operatorname{bit}(x)\).

时间复杂度为 \(O(\log^4 n+q\log^3 n)\).

posted @ 2026-08-15 16:46  Zhou_Lemon  阅读(12)  评论(0)    收藏  举报