cf/mirror

Obtain a Permutation

CF
1294E1900· candidate master2s256 MB⌨ stdin/stdout

Examples

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