#P3475. [POI 2008] POD-Subdivision of Kingdom

    ID: 2530 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp2008POISpecial Judge深度优先搜索,DFS状态压缩,状压

[POI 2008] POD-Subdivision of Kingdom

Description

Given an undirected graph with nn vertices and mm edges, you need to find a valid partition of the vertices into two sets, each of size n2\frac{n}{2}, such that the number of edges whose endpoints lie in different sets is minimized.

Input Format

The first line contains two integers n,mn, m.

Then follow mm lines, each containing two integers a,ba, b, indicating that there is an edge between aa and bb.

Output Format

Output one line with n2\frac{n}{2} 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 100%100\% of the testdata, 1n261 \le n \le 26, 1a,bn1 \le a, b \le n, and nn is even. It is guaranteed that there are no multiple edges.

Translated by ChatGPT 5