logo AlgoBeat OnlineJudge
登录 注册

#212519. [INOI Team Selection 2021] Color Colony

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

A path is bad if and only if the colors of all edges in it are different, otherwise, the path is good.

A tree is bad if and only if there exists a path of length in it which is bad, otherwise, the tree is good.

Now we have a tree, we want to color its edges, the beauty of coloring of edges is the number of different colors we use, we want to make the beauty of coloring maximum possible, and we don't want our tree to become bad, what is maximum beauty we can reach?

输入格式

The first line of the input contains and , the number of vertices of the tree, and the value which declares we shouldn't have a bad path of length in tree.

The following lines describe the edges of the tree. The -th line contains two integers and , denotes an edge between and . It is guaranteed that these edges form a tree.

输出格式

Print one integer, the maximum number of colors we can use.

样例

样例输入 1

4 2
1 2
1 3
1 4

样例输出 1

1

样例输入 2

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

样例输出 2

3

样例输入 3

11 3
1 8
1 7
1 3
1 2
2 11
2 10
2 9
3 5
3 4
3 6

样例输出 3

7

数据范围与提示

Constraints

Subtask

subtask score limits
1 19 degree of each vertex in the tree is at most 3.
2 7
3 18 ,
4 22
5 25
6 9 No extra limits