正文
增加 14 行删除 14 行
41 行未改动4243444546474849505152535455565758596061626364656667686970717273747576777828 行未改动10710810911011111211311411511611711811920 行未改动14014114214314414514614714813 行未改动16216316416516616716816917057 行未改动2282292302312322332342352362372382392402412422432442452467 行未改动41 行未改动```cpp line-numbers// code by 樓影沫瞬_Hz17#include <bits/stdc++.h>#define getc() getchar_unlocked()#define putc(a) putchar_unlocked(a)#define en_ putc('\n')#define e_ putc(' ')using std::cout;using std::cerr;template<class T> inline T in() {T n = 0; char p = getc();while(p < '-') p = getc();bool f = p == '-' ? p = getc() : 0;do n = n * 10 + (p ^ 48), p = getc();while(isdigit(p));return f ? -n : n;}template<class T> inline T in(T &a) { return a = in<T>(); }template<class T, class ... Args> inline void in(T &t, Args&... args) { in(t), in(args...); }template<class T> inline void out(T n) {if(n < 0) putc('-'), n = -n;if(n > 9) out(n / 10);putc(n % 10 + '0');}template<class T1, class T2> T1 max(T1 a, T2 b) { return a > b ? a : a = b;}template<class T1, class T2> T1 min(T1 a, T2 b) { return a < b ? a : a = b;}constexpr uint N = 15e4 + 10, mod = 998244353, B = 450;uint n, m;std::vector<uint> x[N / B + 10];28 行未改动t[t[u].l].tag.times = 1ull * t[t[u].l].tag.times * t[u].tag.times % mod;t[t[u].l].tag.plus = 1ull * t[t[u].l].tag.plus * t[u].tag.times % mod;t[t[u].r].tag.times = 1ull * t[t[u].r].tag.times * t[u].tag.times % mod;t[t[u].r].tag.plus = 1ull * t[t[u].r].tag.plus * t[u].tag.times % mod;t[u].tag.times = 1;}if(t[u].tag.plus) {if(!t[u].l) t[u].l = append();if(!t[u].r) t[u].r = append();t[t[u].l].tag.plus = (t[t[u].l].tag.plus + t[u].tag.plus) % mod;t[t[u].r].tag.plus = (t[t[u].r].tag.plus + t[u].tag.plus) % mod;t[u].tag.plus = 0;}20 行未改动if(p <= mid) return query(t[u].l, l, mid, p);return query(t[u].r, mid + 1, r, p);}#undef midinline void clear() {for(uint v : stk) pool[++ tp] = v;stk.clear();}} ;13 行未改动}}inline void Erase(uint id) {changed = 1;for(iter it = calc.begin(); it != calc.end(); it ++)if(it->id == id) {calc.erase(it);break;}57 行未改动Q[i].r = std::lower_bound(x[j].begin(), x[j].end(), Q[i].r) - x[j].begin();}}}for(uint i = 1, op, l, r, d; i <= m; i ++) {op = Q[i].op;if(op == 1 || op == 2) {l = Q[i].l, r = Q[i].r, d = Q[i].d;A[pos[i]].Insert({l, r, op, d, i});}if(op == 3) {d = Q[i].d;uint ans = 0;for(uint j = 1; j <= pos[i]; j ++)A[j].Query(ans, std::lower_bound(x[j].begin(), x[j].end(), d) - x[j].begin());out(ans), en_;}if(op == 4) {7 行未改动41 行未改动4243444546474849505152535455565758596061626364656667686970717273747576777828 行未改动10710810911011111211311411511611711811920 行未改动14014114214314414514614714813 行未改动16216316416516616716816917057 行未改动2282292302312322332342352362372382392402412422432442452467 行未改动41 行未改动```cpp line-numbers// code by 樓影沫瞬_Hz17#include <bits/stdc++.h>#define getc() getchar_unlocked()#define putc(a) putchar_unlocked(a)#define en_ putc('\n')#define e_ putc(' ')using std::cout;using std::cerr;template<class T> inline T in() {T n = 0; char p = getc();while(p < '-') p = getc();bool f = p == '-' ? p = getc() : 0;do n = n * 10 + (p ^ 48), p = getc();while(isdigit(p));return f ? -n : n;}template<class T> inline T in(T &a) { return a = in<T>(); }template<class T, class ... Args> inline void in(T &t, Args&... args) { in(t), in(args...); }template<class T> inline void out(T n) {if(n < 0) putc('-'), n = -n;if(n > 9) out(n / 10);putc(n % 10 + '0');}template<class T1, class T2> T1 max(T1 a, T2 b) { return a > b ? a : a = b;}template<class T1, class T2> T1 min(T1 a, T2 b) { return a < b ? a : a = b;}constexpr uint N = 15e4 + 10, mod = 998244353, B = 450;uint n, m;std::vector<uint> x[N / B + 10];28 行未改动t[t[u].l].tag.times = 1ull * t[t[u].l].tag.times * t[u].tag.times % mod;t[t[u].l].tag.plus = 1ull * t[t[u].l].tag.plus * t[u].tag.times % mod;t[t[u].r].tag.times = 1ull * t[t[u].r].tag.times * t[u].tag.times % mod;t[t[u].r].tag.plus = 1ull * t[t[u].r].tag.plus * t[u].tag.times % mod;t[u].tag.times = 1;}if(t[u].tag.plus) {if(!t[u].l) t[u].l = append();if(!t[u].r) t[u].r = append();t[t[u].l].tag.plus = (t[t[u].l].tag.plus + t[u].tag.plus) % mod;t[t[u].r].tag.plus = (t[t[u].r].tag.plus + t[u].tag.plus) % mod;t[u].tag.plus = 0;}20 行未改动if(p <= mid) return query(t[u].l, l, mid, p);return query(t[u].r, mid + 1, r, p);}#undef midinline void clear() {for(uint v : stk) pool[++ tp] = v;stk.clear();}} ;13 行未改动}}inline void Erase(uint id) {changed = 1;for(iter it = calc.begin(); it != calc.end(); it ++)if(it->id == id) {calc.erase(it);break;}57 行未改动Q[i].r = std::lower_bound(x[j].begin(), x[j].end(), Q[i].r) - x[j].begin();}}}for(uint i = 1, op, l, r, d; i <= m; i ++) {op = Q[i].op;if(op == 1 || op == 2) {l = Q[i].l, r = Q[i].r, d = Q[i].d;A[pos[i]].Insert({l, r, op, d, i});}if(op == 3) {d = Q[i].d;uint ans = 0;for(uint j = 1; j <= pos[i]; j ++)A[j].Query(ans, std::lower_bound(x[j].begin(), x[j].end(), d) - x[j].begin());out(ans), en_;}if(op == 4) {7 行未改动