虚树
作者:互联网
https://blog.csdn.net/weixin_37517391/article/details/82744605
void insert(int u){ if(top <= 1) {stk[++top] = u;return ;} int lca = LCA(u,stk[top]); if(lca == stk[top]) {stk[++top] = u;return ;} while(top > 1 && dfn[lca] <= stk[top-1]) { addedge(stk[top-1],stk[top]); --top; } if(lca != stk[top]) stk[++top] = lca; stk[++top] = u; }
标签:insert,weixin,void,37517391,虚树,&&,top 来源: https://www.cnblogs.com/xyj1/p/14499153.html