这份代码为何能过
查看原帖
这份代码为何能过
1145602
dongzhen楼主2025/1/20 11:21
void dfs(int u,int fa){
	if(dfn[u]){return;}
	dfn[u]=low[u]=++cnt;int son=0;
	for(int to: G[u]){
		if(to==fa){continue;}
		if(dfn[to]){low[u]=min(low[u],dfn[to]);}
		else{
			++son;
			dfs(to,u);
			low[u]=min(low[u],low[to]);
			if(low[to]>=dfn[u]){cut.insert(u);}
		}
	}
	if(fa==0 && son<2){cut.erase(u);}
}
2025/1/20 11:21
加载中...