摘要:
#include#include#include#includeusing namespace std;#define maxn 210000int ch[maxn][2],pre[maxn];int siz[maxn];bool rt[maxn];void pushup(int x){ siz[x]=1+siz[ch[x][0]]+siz[ch[x][1]];}void rotate(int x){ int y=pre[x],k=ch[y][0]==x; ch[y][!k]=ch[x][k]; pre[ch[x][k]]=y; pre[x]=pre[y]; pre[y]=x... 阅读全文