Testing Round 10
D
Berland Federalization
Codeforces
2200
原题
← C→
翻译中…

Recently, Berland faces federalization requests more and more often. The proponents propose to divide the country into separate states. Moreover, they demand that there is a state which includes exactly $*k*$ towns.

翻译中…

Currently, Berland has $*n*$ towns, some pairs of them are connected by bilateral roads. Berland has only $*n* - 1$ roads. You can reach any city from the capital, that is, the road network forms a tree.

翻译中…

The Ministry of Roads fears that after the reform those roads that will connect the towns of different states will bring a lot of trouble.

翻译中…

Your task is to come up with a plan to divide the country into states such that:

翻译中…
  • each state is connected, i.e. for each state it is possible to get from any town to any other using its roads (that is, the roads that connect the state towns),
  • there is a state that consisted of exactly $*k*$ cities,
  • the number of roads that connect different states is minimum.
翻译中…

Input

翻译中…

The first line contains integers $*n*$, $*k*$ ($1 ≤ *k* ≤ *n* ≤ 400$). Then follow $*n* - 1$ lines, each of them describes a road in Berland. The roads are given as pairs of integers $*x*_{*i*}, *y*_{*i*}$ ($1 ≤ *x*_{*i*}, *y*_{*i*} ≤ *n*; *x*_{*i*} ≠ *y*_{*i*}$) — the numbers of towns connected by the road. Assume that the towns are numbered from 1 to $*n*$.

翻译中…

Output

翻译中…

The the first line print the required minimum number of "problem" roads $*t*$. Then print a sequence of $*t*$ integers — their indices in the found division. The roads are numbered starting from 1 in the order they follow in the input. If there are multiple possible solutions, print any of them.

翻译中…

If the solution shows that there are no "problem" roads at all, print a single integer 0 and either leave the second line empty or do not print it at all.

翻译中…

样例

Input #1
5 2
1 2
2 3
3 4
4 5
Output #1
1
2
InputCopy OutputCopy
Input #2
5 3
1 2
1 3
1 4
1 5
Output #2
2
3 4
InputCopy OutputCopy
Input #3
1 1
Output #3
0
InputCopy OutputCopy
题目信息
题号
440D
所属比赛
时间限制
1 s
内存限制
256 MB
标签
动态规划
树

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