1 void dfs(int u,int father) 2 { 3 int child=0; 4 dfn[u]=low[u]=++dfs_clock; 5 6 for (int c=head[u];c;c=nxt[c]) 7 { 8 int v=to[c]; 9 if (!dfn[v]) 10 { 11 child++; 12 dfs(v,u); 13 low[u]=min(low[u],low[v]); 14 if (low[v]>=dfn[u]) 15 is_cut[u]=true; 16 } 17 else if (v!=father) 18 low[u]=min(low[u],dfn[v]); 19 } 20 21 if (!father && child==1) 22 is_cut[u]=0; 23 }
时间: 2024-11-05 20:34:32