atcoder#NIKKEI20192QUALC. Swaps
Swaps
Score : points
Problem Statement
Given are two integer sequences of elements each: and . Determine if it is possible to do the following operation at most times (possibly zero) so that, for every integer from to , holds:
- Choose two distinct integers and between and (inclusive), and swap the values of and .
Constraints
Input
Input is given from Standard Input in the following format:
Output
If the objective is achievable, print Yes
; if it is not, print No
.
3
1 3 2
1 2 3
Yes
We should swap the values of and .
3
1 2 3
2 2 2
No
6
3 1 2 6 3 4
2 2 8 3 4 3
Yes