시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 256 MB | 51 | 14 | 12 | 42.857% |
Given an undirected graph, find a minimum vertex cover. Crazy, right?
Let $M$ be the size of maximum matching, and $C$ be the size of minimum vertex cover. If minimum vertex cover is smol, which means $C \le M + 1$, then find it.
The first line of input contains two integers $n$ and $m$ ($1 \le n \le 500$, $0 \le m \le \frac{n(n-1)}{2}$) --- the number of vertices and edges in the graph.
Next $m$ lines describe edges of the graph, each of them contains two integers $u$ and $v$ ($1 \le u < v \le n$) --- vertices connected by an edge. Vertices are numbered from $1$ to $n$.
It is guaranteed that the graph doesn't contain multiple edges.
If minimum vertex cover is smol, then print its size $C$ on the first line, and then $C$ different space-separated vertices that form a vertex cover. Otherwise print "not smol
" on a single line (without quotes).
If there are several possible smol minimum vertex covers, print any one of them.
5 5 1 2 2 3 3 4 4 5 1 5
3 2 3 5
5 10 1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5 4 5
not smol
3 0
0
Vertex cover is a set of vertices such that for each edge at least one of the endpoints belongs to the set.
Matching is a set of edges such that no two edges from it have common endpoint.
Note that a minimum vertex cover would not be accepted as a correct answer if it is not smol.