#include<cstdio> #include<algorithm> #include<cstring> #define N 80010 #define which(x) (ls[fa[(x)]]==(x)) using namespace std; int id[N],pos[N],sz[N],ls[N],rs[N],fa[N],tot,n,m,root,a[N]; ]; +sz[ls[x]]+sz[rs[x]];} int Build(int l,int r,i…
思路:搞搞平衡树. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define y1 skldjfskldjg #define y2 skldfjsklejg using namespace std; ; ; const int inf = 0x3f3f3f3f; cons…