cf/mirror

Flow Optimality

CF
457E3000· legendary gm2s256 MB⌨ stdin/stdout

Examples

Sample 1of 4
Input
4 5
1 2 1 2
1 3 4 1
2 3 2 1
2 4 4 1
3 4 1 2
Output
6
Sample 2of 4
Input
5 5
2 3 1 1
3 4 1 1
4 2 1 1
1 5 1 1
1 5 100 100
Output
BAD 3
Sample 3of 4
Input
6 4
1 3 31 41
1 5 59 26
2 6 53 58
4 6 97 93
Output
UNKNOWN
Sample 4of 4
Input
7 5
1 7 2 1
2 3 1 1
4 5 1 0
6 1 10 0
1 3 1 1
Output
BAD 4
457E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…