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

19265번 - Is It a p-drome? 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 256 MB115373031.579%

문제

Let's suppose that we have fixed a permutation $p$ with length $n$. We say that a string $t$ is a $p$-drome if it has the length $n,ドル and for all the characters of this string, it is true that $t_i = t_{p_i}$.

You have a string $s$ and a permutation $p$. For each substring of $s$ of length $n,ドル you have to find out if it is a $p$-drome or not.

입력

On the first line, you are given three integers $n,ドル $m,ドル and $c$: the length of the permutation, the length of the string and the size of the alphabet of the string (1ドル \le n \le m \le 500,000円$; 1ドル \le c \le 500,000円$).

On the second line, you are given $n$ integers $p_i$: the permutation itsekf (1ドル \le p_i \le n$; $p_i \ne p_j$ if $i \ne j$).

On the third line, you are given $m$ integers $s_i$: the initial string (1ドル \le s_i \le c$).

출력

Print $m-n+1$ characters without spaces: $i$-th character must be "1" if substring $s_i \ldots s_{i+n-1}$ is a $p$-drome, and "0" otherwise.

제한

예제 입력 1

3 5 1
1 2 3
1 1 1 1 1

예제 출력 1

111

예제 입력 2

3 7 3
3 2 1
1 2 1 3 1 2 1

예제 출력 2

10101

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 2: ITMO U 1 Contest I번

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

출처

대학교 대회

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

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