版本比较
题解 P4565 【[CTSC2018]暴力写挂】
正文
增加 2 行删除 2 行
50 行未改动5152535455555657585941 行未改动10110210310410510510610710810977 行未改动50 行未改动 deep[e[i].v]=deep[x]+e[i].w; son[x].push_back(e[i].v);v[x].push_back(e[i].w); dfs1(e[i].v,x); }} }void getrt(int x,int fa) { sum[x]=1; for(re int i=head[x];i;i=e[i].nxt) { if(vis[i>>1]||e[i].v==fa) continue;41 行未改动 inline void ins(int x) { if(top<1) {st[++top]=x;return;} int lca=LCA(x,st[top]); if(lca==st[top]) {st[++top]=x;return;} while(top>1&&dfn[st[top-1]]>=dfn[lca]) while(top>1&&dfn[st[top-1]]>=dfn[lca]) add(st[top-1],st[top],0),top--; if(lca!=st[top]) add(lca,st[top],0),st[top]=lca; st[++top]=x; }77 行未改动