写一个极短的splay函数:
int ch[N][
2], v[N], fa[N], Index, m;
void rotate(
int x){
int y = fa[x], f = fa[y], t = ch[y][
1] == x;
fa[ch[y][t] = ch[x][t^
1]] = y, fa[ch[x][t^
1] = y] = x;
if (fa[x] = f) ch[f][ch[f][
1]==y] = x;
}
void splay(
int x){
for(
int y;y=fa[x];rotate(x))
if(fa[y]) rotate(((lc(y)==x)^(lc(fa[y])==y))?x:y);
}