若你的代码中需要使用平衡树,例如 FHQ_Treap 或者 Splay,TLE 或者 MLE 了的话,可以试着使用神奇的 vector,直接 AC 了。
e.g
int cnt,rt[N];
vector <int> t[N];
void insert(int &root,int x){
if(!root) root=++cnt;
t[root].insert(lower_bound(t[root].begin(),t[root].end(),x),x);
}
void del(int root,int x){
t[root].erase(lower_bound(t[root].begin(),t[root].end(),x));
}
int kth(int u,int k){
return t[u][k-1];
}