Problem′s Website
Problem′s Description
- 给定一个序列,每次操作使区间[l−r]翻转。
Solution
因为本人暂时不会Splay,所以这题我用fhq−Treap来写。
思路还是比较明确的,将要翻转的区间分裂出来,然后维护一个翻转标记(类似于线段树的Lazy Tag)。
关于如何分裂,大家可以打一下草,我们先以l−1将区间分成r1,r2两段,再在r2的区间中以序列长度(r−l+1)分成r2,r3两段,那么r2就是目标区间。
Code
1 | //Coded by Dy. |
rp++
Related Issues not found
Please contact @dyrisingsunlight to initialize the comment