@[LiBoyi](/user/226113) 这里是不是要`while`?
```cpp
if(top[x]!=top[y]){
if(dep[top[x]]<dep[top[y]])
swap(x,y);
res+=query(num[top[x]],num[x],1,1,n);
x=f[top[x]];
}
```
by Acfboy @ 2020-08-26 11:47:18
@[LiBoyi](/user/226113) 我终结了这个问题,这样一改就过了。(在LOJ上,我不敢在洛谷交,怕被棕)
by Acfboy @ 2020-08-26 11:48:57
@[Acfboy](/user/40318) 谢谢大佬
by 火羽白日生 @ 2020-08-26 13:59:50