cf/mirror

Policeman and a Tree

CF
868E2700· international gm2s256 MB⌨ stdin/stdout

Examples

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