BZOJ3236 作业
好厉害的数据结构题,时限太吓人了。 最初想写莫队的,但是在数据范围下屈服了。 用可持久化线段树套可持久化线段树来维护可过。虽然跑了97s。本机跑得快得多,虽然有两个点被卡到了18s。 #include <cstdio> #include <cctype> #include <cstring> #include <algorithm> using namespace std; struct seg { int v, ls, rs; }; #define readInt(_s_) {\ _s_ = 0;\ int _d_ = 0;\ while (!isdigit(_d_ = getchar()));\ while ((_s_ = _s_ * 10 + _d_ - 48), isdigit(_d_ = getchar()));\ } const int maxn = 100009; const int maxl = 20; const int maxnd = maxn * maxl * maxl; seg s[maxnd]; int n, m, t, a[maxn], d[maxn], c[maxn], *r[maxn], sp, rt[maxn];...