cf/mirror

Weight the Tree

CF
1646D2000· candidate master2s256 MB⌨ stdin/stdout

Examples

Sample 1of 4
Input
4
1 2
2 3
2 4
Output
3 4
1 1 1 1
Sample 2of 4
Input
3
1 2
1 3
Output
2 3
1 1 1
Sample 3of 4
Input
2
1 2
Output
2 2
1 1
Sample 4of 4
Input
9
3 4
7 6
2 1
8 3
5 6
1 8
8 6
9 6
Output
6 11
1 1 1 1 1 1 1 3 1
1646D.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…