Rt, 在实现 LCT 模板题中 cut 函数时,我两种写法得到的结果不同(第二种 93pts WA test 8),想问一下原因,谢谢!
两种写法中 cut 函数:
void cut(int x,int y){
makeroot(x);
if(findroot(y)==x&&t[y].fa==x&&t[y].ls==0)t[x].rs=t[y].fa=0,psu(x);
}
void cut(int x,int y){
makeroot(x);
if(t[y].fa==x&&findroot(y)==x&&t[y].ls==0)t[x].rs=t[y].fa=0,psu(x);
}
即交换 && 前后条件顺序。