cf/mirror

Standard Graph Problem

CF
1870H3500· legendary gm2s512 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
4 5 6
1 2 1
2 3 5
3 2 3
4 1 8
2 1 4
+ 1
- 1
+ 3
+ 1
+ 4
+ 2
Output
15
-1
14
12
4
0
Sample 2of 2
Input
10 14 10
8 6 4
2 5 1
3 5 4
1 6 3
1 3 7
7 2 1
6 1 3
4 10 1
4 6 5
5 4 1
5 8 10
10 9 1
9 5 1
9 7 6
+ 7
+ 8
- 7
+ 10
+ 2
- 10
+ 5
- 2
- 5
+ 3
Output
28
24
29
19
18
24
18
19
29
20
1870H.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…