In mathematics you don't understand things, you just get used to them.

link。首先二分答案固定每个 bot 的步长,然后就基本上弱于 codeforces - 1476F 了,但是还是有些不一样的地方。假如我们是在一个序列上做 dp,不妨把原环按 $n$-$1$...

link。Lagrange Interpolation。朴素的 dp 即设 $f_i(j)$ 表示前 $i$ 个位置,最大值为 $j$,位置 $i$ 可选可不选的方案数,转移即 $\displa...