#include #include #include using namespace std; const int maxn = 1e5 + 10; vector graph[maxn]; int discovarable_time[maxn]; int low_link[maxn]; bool on_stack[maxn]; int current_time = 0; int n; void dfs(int node, int parent) { on_stack[node] = true; low_link[node] = current_time; discovarable_time[node] = current_time; current_time++; int root = 0; for(int i = 0; i < (int) graph[node].size(); i++) { int neighbour = graph[node][i]; if(neighbour != parent) { if(on_stack[neighbour]) { low_link[node] = min(low_link[node], discovarable_time[neighbour]); } else { dfs(neighbour, node); low_link[node] = min(low_link[node], low_link[neighbour]); if(parent != -1 and low_link[neighbour] >= discovarable_time[node]) { cout << "articulation point: " << node + 1 << endl; } root++; } } } if(root > 1 and parent == -1) { cout << "articulation point: " << node + 1 << endl; } } void art_points() { for(int i = 0; i < maxn; i++) { discovarable_time[i] = -1; on_stack[i] = false; low_link[i] = -1; } for(int i = 0; i < n; i++) { if(!on_stack[i]) { dfs(i, -1); } } } int main() { int m; cin >> n >> m; for(int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; graph[a].push_back(b); graph[b].push_back(a); } art_points(); return 0; }