由于本题有很多Splay树,在rotate的时候一定不要写 if(z) t[z].son[t[z].son[1] == y] = x; 因为z可能不是这颗splay的根并且是一个存在的点
if(z) t[z].son[t[z].son[1] == y] = x;
要写成 if(!isroot(y)) rot((t[z].son[1] == y) ^ (t[y].son[1] == x) ? x : y);
if(!isroot(y)) rot((t[z].son[1] == y) ^ (t[y].son[1] == x) ? x : y);
用一个函数去判断
因此wa了一页