#P3388. Articulation Points in an Undirected Graph
Articulation Points in an Undirected Graph
Articulation Points in an Undirected Graph
Given an undirected graph with \(n\) nodes and \(m\) edges, identify all the articulation points (cut vertices) in the graph. An articulation point is a vertex whose removal increases the number of connected components. Output the articulation points in ascending order. If no articulation point exists, output -1.
inputFormat
The first line contains two integers \(n\) and \(m\) representing the number of vertices and edges respectively. Each of the following \(m\) lines contains two integers \(u\) and \(v\), denoting an undirected edge between vertices \(u\) and \(v\).
outputFormat
Print all the articulation points in ascending order, separated by a space. If there is no articulation point, print -1.
sample
5 5
1 2
2 3
2 4
4 5
2 5
2