cf/mirror

Little Girl and Problem on Trees

CF
276E2100· master2s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
3 6
1 2
1 3
0 3 1 2
0 2 3 1
0 1 5 2
1 1
1 2
1 3
Output
9
9
6
Sample 2of 2
Input
6 11
1 2
2 5
5 4
1 6
1 3
0 3 1 3
0 3 4 5
0 2 1 4
0 1 5 5
0 4 6 2
1 1
1 2
1 3
1 4
1 5
1 6
Output
11
17
11
16
17
11
276E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…