#P1798. F - Tree Patrolling

F - Tree Patrolling

题目描述

PDF

输入格式

As shown in the pdf.

输出格式

As shown in the pdf.

样例

3 
1 3 
1 2 

1 
0 
2 
5 

5 
1 3 
4 5 
1 5 
2 3 

1 
0 
2 
5 
7 
17 

10 
6 10 
1 8 
2 7 
5 6 
3 8 
3 4 
7 10 
4 9 
2 8 

1 
0 
3 
8 
15 
32 
68 
110 
196 
266 
325 

提示

AtCoder Beginner Contest 207 by 杨鑫