CF1056D Decorate Apple Tree
题目描述
### 题目大意
给你一个 $n$ 个结点以 $1$ 为根的树,给这颗树的叶子结点任意染色,定义一个点为快乐结点当且仅当这个结点的子树上所有叶子节点颜色均不相同。求出对于 $1\sim n$ 中的每一个 $k$ ,快乐结点数大于等于 $k$ 所需要的最少颜色数。
输入格式
第一行一个数$n(1\le n\le 10^5)$,表示结点数量
第二行$n-1$个数$p_i$,表示第$i$个结点的父亲结点$(1\le p_i
输出格式
一行,$n$个数,表示对于$1\sim n$中的每一个$k$,快乐节点数大于等于$k$时所需的最少颜色数
说明/提示
In the first example for $ k = 1 $ and $ k = 2 $ we can use only one color: the junctions $ 2 $ and $ 3 $ will be happy. For $ k = 3 $ you have to put the bulbs of different colors to make all the junctions happy.
In the second example for $ k = 4 $ you can, for example, put the bulbs of color $ 1 $ in junctions $ 2 $ and $ 4 $ , and a bulb of color $ 2 $ into junction $ 5 $ . The happy junctions are the ones with indices $ 2 $ , $ 3 $ , $ 4 $ and $ 5 $ then.