Logo
(追記) (追記ここまで)

23678번 - Formally, You Choose Three Integers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB6511816.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.

제한

예제 입력 1

3
1 2 1
1 1 2

예제 출력 1

0

예제 입력 2

4
1 2 3 4
3 4 1 2

예제 출력 2

1

예제 입력 3

4
1 2 3 4
1 4 3 2

예제 출력 3

0

힌트

출처

Contest > Open Cup > 2018/2019 Season > Stage 13: Grand Prix of Bytedance F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /