@[_tourist_](/user/69107)
by JK_LOVER @ 2020-08-04 10:45:12
~~~
void link(int x,int y){
makeroot(x);
fa[x]=y;
//pushup(y)????
}
~~~
先说这行代码本来就是多余的,link没有改变y的实儿子。
by JK_LOVER @ 2020-08-04 10:46:19
再说,y的父亲(祖先)被修改过。标记要下传。
~~~
void link(int x,int y){
makeroot(x);
access(y);
splay(y);
fa[x]=y;
pushup(y);
}
~~~
by JK_LOVER @ 2020-08-04 10:47:16
@[_tourist_](/user/69107) 你可以这样试试。
by JK_LOVER @ 2020-08-04 10:47:41
@[JK_LOVER](/user/227824)
明白了,原来是还没$pushdown$就把父亲答案改了,thanks very much.
by _tourist_ @ 2020-08-04 10:56:16
@[_tourist_](/user/69107) 老网络诈骗了
by Oakenshield @ 2020-08-04 14:43:33