Codeforces Round 480 (Div. 2)
E
The Number Games
Codeforces
2200
原题
← DF →
翻译中…

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?

翻译中…

Input

翻译中…

The first line of input contains two integers $n$ and $k$ ($1 \leq k \lt 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.

翻译中…

Output

翻译中…

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

翻译中…

Note

翻译中…

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.

翻译中…

样例

Input #1
6 3
2 1
2 6
4 2
5 6
2 3
Output #1
1 3 4
InputCopy OutputCopy
Input #2
8 4
2 6
2 7
7 8
1 2
3 1
2 4
7 5
Output #2
1 3 4 5
InputCopy OutputCopy
题目信息
题号
980E
时间限制
3 s
内存限制
256 MB
标签
数据结构
贪心
树

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。