我想要打一个Splay
大规模单步调试现场 这里只提供模板,详细解说请参见 这位大佬 的题解。 注意,这位大佬的rank操作跑的飞飞飞飞飞慢,利用Find操作优化之后可以极大优化时间 #include<cstdio> #include<iostream> #include<cmath> #include<fstream> #include<time.h> using namespace std; char *p1,*p2,buf[1<<20]; #define GC (p1==p2&&(p1=buf,p2=buf+fread(buf,1,1<<20,stdin),p1==p2)?0:(*(p1++))) //#define GC getchar() inline int in() { int x=0,w=0; char ch=0; while(!isdigit(ch)){ w|=ch=='-'; ch=GC; } while(isdigit(ch)){ x=(x<<3)+(x<<1)+(ch^48); ch=GC; } return w?-x:x; } struct node{ int id,f; int son[2]; int size; int cnt; }; const int maxn=200010; struct tree{ node t[maxn]; int n,points; #define