专栏文章

Solution of CF207B3 Military Trainings

CF207B3题解参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@mir1pm1q
此快照首次捕获于
2025/12/04 14:19
3 个月前
此快照最后确认于
2025/12/04 14:19
3 个月前
查看原文
你可以浏览这个题解的中文版本
The images are hosted on Github, use an accelerator if it fails to load.
It is first easy to think of duplicating the sequence over and over again, breaking the ring into a chain, with each query i.e. querying a sub-segment answer.
Let fif_i be transferable from j=xj=x or j=yj=y, and consider a greedy.
where P(k)P(k) denotes the points from which fkf_k can be transferred, i.e. P(k)=[kpk,k1]P(k)=[k-p_k,k-1].
Since k1P(k)k-1\in P(k) holds, we do not need to consider the contribution of the interval [ipi,k1][i-p_i,k-1]. Instead, [ypy,ipi][xpx,ipi][y-p_y,i-p_i]\subseteq[x-p_x,i-p_i], i.e., all points that can be transferred to yy can be transferred to xx, so it is sufficient to choose a transfer from xx. That is, it is not inferior to transfer from the smaller kk of kpkk-p_k. Maintained in ST tables, complexity O(nlogn+ans)\mathcal{O}(n\log n+\text{ans}).
You submited the code and found it accepted in the simulation game. You can use multiplicative preprocessing to figure out where you can jump 2n2^n steps, optimising to O(nlogn)\mathcal{O}(n\log n).

评论

0 条评论,欢迎与作者交流。

正在加载评论...