| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 32 | 21 | 20 | 66.667% |
You are given an bidirectional graph with $(n + 1)$ vertices numbered from $0$ to $n$. There are no loops and no multiple edges in this graph. Additionally, all cycles pass through vertex 0. Your task is to remove the minimum possible number of vertices so that there are no cycles in the graph. You can not remove the vertex number 0.
On the first line, there are two integers $n$ and $m$: the number of vertices excluding vertex $0$ and the number of edges ($1 \le n \le 10^5$, $1 \le m \le 10^6$).
Each of next $m$ lines contains two integers $a$ and $b$: the numbers of vertices connected by an edge ($0 \le a, b \le n$).
It is guaranteered that all cycles pass through vertex $0$.
On the first line, print one integer $k$: the minimum possible number of vertices to remove. On the second line, print $k$ integers: the numbers of the vertices to remove in any order. If there are several optimal answers, print any one of them.
4 6 0 1 1 2 2 0 0 3 3 4 4 0
2 1 3
3 5 0 1 1 2 2 0 2 3 3 0
1 2