「POI2011」Meteors
「POI2011」Meteors 传送门 整体二分,树状数组实现区间修改单点查询,然后注意修改是在环上的。 参考代码: #include <cstdio> #include <vector> #define rg register #define file(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout) using namespace std; template < class T > inline void read(T& s) { s = 0; rg int f = 0; rg char c = getchar(); while ('0' > c || c > '9') f |= c == '-', c = getchar(); while ('0' <= c && c <= '9') s = s * 10 + c - 48, c = getchar(); s = f ? -s : s; } const int _ = 9e5 + 5; int n, m, k, p[_], tr[_], ans[_]; vector < int > pos[_]; int num; struct node { int opt, l, r, x, id; } t[_], tt1[_], tt2[_]; inline