Formally, You Choose Three Integers
시간 제한2초메모리 제한512 MB
짝수 길이 부분 배열을 짝수 칸만큼 회전시키는 연산으로 배열 a를 b로 바꿀 수 있는지 판정한다.
문제
You are given two arrays and of the same length .
You are allowed to perform zero or more operations on 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 and (, is even, is even) and becomes equal to , where denotes a slice with Python indexing. Precisely, it contains elements in the range of indices in 0-indexing and in 1-indexing.
Is it possible to transform into ?
입력
The first line contains a single integer (), the length of and .
The second line contains integers (), elements of .
The third line contains integers (), elements of .
출력
Print 1 if it is possible to transform into and 0 otherwise.