割点

#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
const int N = 1e6 + 5;
vector<int> g[N];
int dfn[N], low[N];
int ans[N], vis[N];
int n, m, res, dfncnt, root;
inline void tarjan(int u, int fa)
{
	dfn[u] = low[u] = ++dfncnt;//时间戳 
	int child = 0;
	for(int i = 0; i < g[u].size(); i++){
		int v = g[u][i];
		if(!dfn[v]){
			child++;
			tarjan(v, u);
			low[u] = min(low[u], low[v]);
			if(dfn[u] <= low[v]){//是割点 
				if(child > 1 || u != root) ans[u] = 1;//标记 
			} 
		}
		else if(v != fa) low[u] = min(low[u], dfn[v]); 
	}
}
int main()
{
	cin >> n >> m;
	for(int i = 1; i <= m; i++){
		int x, y;
		cin >> x >> y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	for(int i = 1; i <= n; i++){
		if(!dfn[i]){
			root = i;
			tarjan(i, i);
		}
	}
	for(int i = 1; i <= n; i++){
		if(ans[i]) res++;
	}
	cout << res << "\n";
	for(int i = 1; i <= n; i++){
		if(ans[i]) cout << i << " ";
	}
	return 0;
}