#x1077. You Are Given a Tree

You Are Given a Tree

You Are Given a Tree

题面翻译

有一棵 nn 个节点的树。

其中一个简单路径的集合被称为 kk 合法当且仅当:

树的每个节点至多属于其中一条路径,且每条路径恰好包含 kk 个点。

对于 k[1,n]k\in [1,n],求出 kk 合法路径集合的最多路径数 即:设 kk 合法路径集合为 SS,求最大的 S|S|

n105n \leq 10^5

题目描述

A tree is an undirected graph with exactly one simple path between each pair of vertices. We call a set of simple paths k k -valid if each vertex of the tree belongs to no more than one of these paths (including endpoints) and each path consists of exactly k k vertices.

You are given a tree with n n vertices. For each k k from 1 1 to n n inclusive find what is the maximum possible size of a k k -valid set of simple paths.

输入格式

The first line of the input contains a single integer n n ( 2n100000 2 \le n \le 100\,000 ) — the number of vertices in the tree.

Then following n1 n - 1 lines describe the tree, each of them contains two integers v v , u u ( 1v,un 1 \le v, u \le n ) — endpoints of the corresponding edge.

It is guaranteed, that the given graph is a tree.

输出格式

Output n n numbers, the i i -th of which is the maximum possible number of paths in an i i -valid set of paths.

样例 #1

样例输入 #1

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

样例输出 #1

7
3
2
1
1
1
1

样例 #2

样例输入 #2

6
1 2
2 3
2 4
1 5
5 6

样例输出 #2

6
2
2
1
1
0

提示

One way to achieve the optimal number of paths for the second sample is illustrated in the following picture: