Codeforces 558 D. Guess Your Way Out! II

来源:互联网 发布:oracle sql语句面试题 编辑:程序博客网 时间:2024/05/21 06:57

http://codeforces.com/problemset/problem/558/D

我先把q个区间都下移到叶子层,映射一下,若[l,r] 为 1,则[l,r] 的 g[]值 + 1,否则其补集所在的区间 +1,对于区间所有数 +1,可以先 g[l] + 1, g[r+1] - 1,最后在求一下和。然后看看g[] = q的点有几个。



0 0