cf/mirror

Two Permutations (Hard Version)

CF
1882E23100· legendary gm2s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
3 5
2 1 3
5 2 1 4 3
Output
2
3 4
2 4
Sample 2of 3
Input
4 4
3 4 2 1
2 4 1 3
Output
3
3 3
1 4
4 2
Sample 3of 3
Input
2 2
1 2
2 1
Output
-1
1882E2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)