题号:NC201919
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
It’s well known in China that
)
algorithms can pass the problem with

easily.
You are given a tree with n vertices and n-1 edges
%2C%20(u_2%2C%20v_2)%2C%20%5Cdots%2C%20(u_%7Bn-1%7D%2Cv_%7Bn-1%7D))
. For each vertex

,there is a set

initially.
You need to perform

operations. For the i-th operation, you are given an edge

and let

and

be the union of them.
Finally, you need to find the number of sets
%7D)
contains

for each vertex

.
输入描述:
The first line contains two integers
.
Each line in the following
lines contains two integers
.
The following line contains
integers
.
输出描述:
Output one line with
integers, the
-th of which indicates the number of sets
contains
.
示例1
输入
复制
5 6
1 2
1 3
1 4
1 5
4 3 2 1 2 3