cf/mirror

Keen Tree Calculation

CF
1866K2500· grandmaster2s512 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
7
5 1 2
1 4 2
3 4 1
2 5 3
6 1 6
4 7 2
2
4 3
3 2
Output
18
11
Sample 2of 2
Input
3
1 2 1000000000
2 3 1000000000
1
2 1000000000
Output
2000000000000000000
1866K.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…