| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 (추가 시간 없음) | 512 MB | 65 | 11 | 8 | 16.667% |
You are given two arrays $a$ and $b$ of the same length $n$.
You are allowed to perform zero or more operations on $a$ of the following kind:
Choose a contiguous subarray of even length and cyclically shift it by an even number of positions. Formally, you choose three integers $i, j$ and $k$ (0ドル \leq i < j < k \leq n,ドル $j - i$ is even, $k - i$ is even) and $a$ becomes equal to $a_{0:i} + a_{j:k} + a_{i:j} + a_{k:n},ドル where $a_{l:r}$ denotes a slice with Python indexing. Precisely, it contains elements in the range of indices $[l,r)$ in 0-indexing and $(l,r]$ in 1-indexing.
Is it possible to transform $a$ into $b$?
The first line contains a single integer $n$ (1ドル \leq n \leq 3 \cdot 10^5$), the length of $a$ and $b$.
The second line contains $n$ integers $a_i$ (1ドル \leq a_i \leq n$), elements of $a$.
The third line contains $n$ integers $b_i$ (1ドル \leq b_i \leq n$), elements of $b$.
Print 1 if it is possible to transform $s$ into $t$ and 0 otherwise.
3 1 2 1 1 1 2
0
4 1 2 3 4 3 4 1 2
1
4 1 2 3 4 1 4 3 2
0