13450: [CSP-S2019] 树的重心

Memory Limit:512 MB Time Limit:20.000 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Input

2
5
1 2
2 3
2 4
3 5
7
1 2
1 3
1 4
3 5
3 6
6 7

Output

32
56

Sample Input Copy

2
5
1 2
2 3
2 4
3 5
7
1 2
1 3
1 4
3 5
3 6
6 7

Sample Output Copy

32
56

HINT