cf/mirror

Playing with Permutations

CF
251B1800· expert2s256 MB⌨ stdin/stdout

Examples

Sample 1of 5
Input
4 1
2 3 4 1
1 2 3 4
Output
NO
Sample 2of 5
Input
4 1
4 3 1 2
3 4 2 1
Output
YES
Sample 3of 5
Input
4 3
4 3 1 2
3 4 2 1
Output
YES
Sample 4of 5
Input
4 2
4 3 1 2
2 1 4 3
Output
YES
Sample 5of 5
Input
4 1
4 3 1 2
2 1 4 3
Output
NO
251B.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)