cf/mirror

Minimum Difference

CF
1476G3100· legendary gm5s256 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
12 11
2 1 1 2 1 1 3 2 1 1 3 3
1 2 10 3
1 2 11 3
2 7 2
1 3 9 2
1 1 12 1
1 1 12 4
2 12 4
1 1 12 4
2 1 5
1 3 12 2
1 1 4 3
Output
5
4
1
0
-1
5
0
1
1476G.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)