@[smarthehe](/space/show?uid=103732) 这个真的是spalu
by sanaka87 @ 2019-06-08 20:38:36
@[smarthehe](/space/show?uid=103732) 打错了是spaly,你这个是单旋的
by sanaka87 @ 2019-06-08 20:39:03
忘记加
# RT
了
另吸氧极限卡常951ms,看上去不像稳定能过的样子
by smarthehe @ 2019-06-08 20:39:34
@[Owen_codeisqueen](/space/show?uid=77426)
我照着日报学的qwq
by smarthehe @ 2019-06-08 20:39:54
```cpp
inline void splay(int tmp,int aim)
{
while(fa[tmp]!=aim)
{
int f=fa[tmp],grf=fa[f];
if(grf!=aim&&chk(tmp)==chk(f)) rotate(f);
else rotate(tmp);
rotate(tmp);
}
if(!aim) root=tmp;
}
```
改成这样试试
by sanaka87 @ 2019-06-08 20:41:29
@[Owen_codeisqueen](/space/show?uid=77426)
这样很明显有问题啊。。。
而且亲测全T
by smarthehe @ 2019-06-08 20:43:46
@[smarthehe](/space/show?uid=103732) 啊?
正常的splay不都是
```
inline void splay(int rt,int to){
to=g[to].fa;
while (g[rt].fa!=to){
int fa=g[rt].fa;
if (g[fa].fa==to){
rotate(rt);
}else if (wtson(fa)==wtson(rt)){
rotate(fa);rotate(rt);
}else{
rotate(rt);rotate(rt);
}
}
if (!to) root=rt;
}
```
你学的是什么splay...
by sanaka87 @ 2019-06-08 20:46:00
@[smarthehe](/space/show?uid=103732) 日报链接给一下
by sanaka87 @ 2019-06-08 20:46:27
照着日报学splay,wa大佬啊 膜拜!
by 梧桐灯 @ 2019-06-08 20:48:13
@[smarthehe](/space/show?uid=103732) 我错了,这样多rotate了一次
改成
```
inline void splay(int tmp,int aim)
{
while(fa[tmp]!=aim)
{
int f=fa[tmp],grf=fa[f];
if(grf==aim) rotate(rt)
else if(chk(tmp)==chk(f)) rotate(f), rotate(tmp);
else rotate(tmp),rotate(tmp);
}
if(!aim) root=tmp;
}
```
by sanaka87 @ 2019-06-08 20:48:16