#jag2017autumne. [jag2017autumn_e]Tree Separator
[jag2017autumn_e]Tree Separator
MathJax.Hub.Config({ tex2jax: { inlineMath: [[""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 16px; line-height: 18px; background-color: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }
Problem Statement
You are given a tree and an integer . You can choose arbitrary distinct two vertices and on . Let be the simple path between and . Then, remove vertices in , and edges such that one or both of its end vertices is in from . Your task is to choose and to maximize the number of connected components with or more vertices of after that operation.
Input
The input consists of a single test case formatted as follows.
The first line consists of two integers . The following lines represent the information of edges. The -th line consists of two integers $u\_i, v\_i \\ (1 \\le u\_i, v\_i \\le N \\text{ and } u\_i \\ne v\_i \\text{ for each } i)$. Each is an edge of . It's guaranteed that these edges form a tree.
Output
Print the maximum number of connected components with or more vertices in one line.
Sample Input 1
2 1
1 2
Output for Sample Input 1
0
Sample Input 2
7 3
1 2
2 3
3 4
4 5
5 6
6 7
Output for Sample Input 2
1
Sample Input 3
12 2
1 2
2 3
3 4
4 5
3 6
6 7
7 8
8 9
6 10
10 11
11 12
Output for Sample Input 3
4
Sample Input 4
3 1
1 2
2 3
Output for Sample Input 4
1
Sample Input 5
3 2
1 2
2 3
Output for Sample Input 5
0
Sample Input 6
9 3
1 2
1 3
1 4
4 5
4 6
4 7
7 8
7 9
Output for Sample Input 6
2