The Number Games

题意翻译

Panel 国将举办名为数字游戏的年度表演。每个省派出一名选手。 国家有 $n$ 个编号从 $1$ 到 $n$ 的省,每个省刚好有一条路径将其与其他省相连。第 $i$ 个省出来的代表有 $2^i$ 名粉丝。 今年,主席打算削减开支,他想要踢掉 $k$ 个选手。但是,被踢掉的选手的省将很 angry 并且不会让别的任何人从这个省经过。 主席想确保所有剩下选手的省都互相可达,他也希望最大化参与表演的选手的粉丝数。 主席该踢掉哪些选手呢? ### 输入格式 输入 $n,k$ 。( $k < n \leq 10^6$ ) 下来是 $n-1$ 行,一行两个数,代表一条道路的起终点。 ### 输出格式 升序输出要踢掉的选手编号。 感谢@poorpool 提供的翻译

题目描述

The nation of Panel holds an annual show called The Number Games, where each district in the nation will be represented by one contestant. The nation has $ n $ districts numbered from $ 1 $ to $ n $ , each district has exactly one path connecting it to every other district. The number of fans of a contestant from district $ i $ is equal to $ 2^i $ . This year, the president decided to reduce the costs. He wants to remove $ k $ contestants from the games. However, the districts of the removed contestants will be furious and will not allow anyone to cross through their districts. The president wants to ensure that all remaining contestants are from districts that can be reached from one another. He also wishes to maximize the total number of fans of the participating contestants. Which contestants should the president remove?

输入输出格式

输入格式


The first line of input contains two integers $ n $ and $ k $ ( $ 1 \leq k < n \leq 10^6 $ ) — the number of districts in Panel, and the number of contestants the president wishes to remove, respectively. The next $ n-1 $ lines each contains two integers $ a $ and $ b $ ( $ 1 \leq a, b \leq n $ , $ a \ne b $ ), that describe a road that connects two different districts $ a $ and $ b $ in the nation. It is guaranteed that there is exactly one path between every two districts.

输出格式


Print $ k $ space-separated integers: the numbers of the districts of which the contestants should be removed, in increasing order of district number.

输入输出样例

输入样例 #1

6 3
2 1
2 6
4 2
5 6
2 3

输出样例 #1

1 3 4

输入样例 #2

8 4
2 6
2 7
7 8
1 2
3 1
2 4
7 5

输出样例 #2

1 3 4 5

说明

In the first sample, the maximum possible total number of fans is $ 2^2 + 2^5 + 2^6 = 100 $ . We can achieve it by removing the contestants of the districts 1, 3, and 4.