```cpp
void splay(int x){
for(int f=tree[x].fa;f=tree[x].fa,f;rotate(x))
if(tree[f].fa)
rotate(get(x)==get(f)?f:x);
root=x;
}
```
第二行代码中,`f=tree[x].fa`会改变`f`的大小。
还有,剩下部分我没看,不过~~同为写Splay的人~~要记得多Splay几次,树会更平衡
by Yuzilihhh @ 2024-05-05 11:46:08