P27012 [AtCoder] B Problem
普及+
题目描述

Problem Description

Given an undirected graph that does not contain self-loops or multiple edges, select $ K $ vertices from this graph such that no two selected vertices are adjacent, and output them.

Input Format

The input is given from the standard input in the following format:

$ V $ $ E $ $ K $ $ a_1 $ $ b_1 $ $ a_2 $ $ b_2 $ : $ a_E $ $ b_E $

  • The first line contains the number of vertices $ V $ ( $1 \leq V \leq 100$ ), the number of edges $ E $ ( $0 \leq E \leq 4950$ ), and $ K $ ( $1 \leq K \leq V$ ), separated by spaces.
  • The following $ E $ lines contain the indices of the vertices connected by the $ i $-th edge $ a_i $ and $ b_i $ ( $0 \leq a_i, b_i \leq V-1$ ), separated by spaces.
  • The given graph does not contain self-loops or multiple edges.
  • It is guaranteed that there exists a way to choose vertices that satisfies the conditions.

Output Format

Output the indices of the selected $ K $ vertices, one per line.

Sample Input and Output

Sample Input #1

3 2 2
0 1
1 2

Sample Output #1

2
0

Sample Input #2

5 3 4
0 1
0 2
0 3

Sample Output #2

2
1
3
4

Sample Input #3

4 3 2
0 1
1 2
2 3

Sample Output #3

0
2

Notes/Hints

Scoring

This problem has no partial points. If you solve it correctly, you will be awarded $ 10 $ points.

Sample Explanation 2

The given graph is not necessarily connected.

Sample Explanation 3

Both $\{0, 2\}$ and $\{1, 3\}$ satisfy the conditions. Either output is considered correct.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 2 2 0 1 1 2
样例输出
2 0