cf/mirror

Game On Tree

CF
1452G2700· international gm3s512 MB⌨ stdin/stdout

Examples

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