题解:U409509 接住 Notes

· · 题解

d 的分布方式为每个 d 单独占据一个时刻。只考虑 t 和 f。

多时刻各存在 >2 的 notes 显然合并起来更优。

此时有任意多 1;2 note(s) 的时刻和一次 m+2 notes 的时刻。

对于每个 f,如果和它们相乘的 notes 难度最大,它们相对于 t 产生的贡献越大,故 f 都会尽量向 m+2 靠拢。

随后处理两个 notes 的,2^2+3^2>2\times3\times2,先凑 3^2 在凑 3\times2。

最后加上剩下的 1,2。需要快速幂。