cf/mirror

Almost Permutation

CF
863F2200· master3s512 MB⌨ stdin/stdout
#flows

Examples

Sample 1of 4
Input
3 0
Output
3
Sample 2of 4
Input
3 1
1 1 3 2
Output
5
Sample 3of 4
Input
3 2
1 1 3 2
2 1 3 2
Output
9
Sample 4of 4
Input
3 2
1 1 3 2
2 1 3 1
Output
-1
863F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…