#P3475. [POI 2008] POD-Subdivision of Kingdom
[POI 2008] POD-Subdivision of Kingdom
Description
Given an undirected graph with vertices and edges, you need to find a valid partition of the vertices into two sets, each of size , such that the number of edges whose endpoints lie in different sets is minimized.
Input Format
The first line contains two integers .
Then follow lines, each containing two integers , indicating that there is an edge between and .
Output Format
Output one line with integers: all vertices in one of the sets from your partition, sorted in increasing order by their labels.
6 8
1 2
1 6
2 3
2 5
2 6
3 4
4 5
5 6
1 2 6
Hint
For of the testdata, , , and is even. It is guaranteed that there are no multiple edges.
Translated by ChatGPT 5
京公网安备 11011102002149号