题目链接 //模板吧 #include<cstdio> #include<cctype> #include<algorithm> using namespace std; const int N=40000,INF=1e8; int n,size,root,sz[N],cnt[N],t[N],son[N][2],fa[N]; inline int read() { int now=0,f=1;register char c=getchar(); for(;!isdigi…
平衡树裸题 只需要求前驱后驱 treap写法 const mm=<<; maxnumber=; maxn=; var left,right,fix,key:..maxn]of longint; t,n,ans,i,j,k,l,tot:longint; function min(x,y:longint):longint; begin if x<y then exit(x); exit(y); end; function max(x,y:longint):longint; begin if…