Is It a p-drome?
시간 제한5초메모리 제한256 MB
순열 p와 문자열 s가 주어질 때, 모든 위치에서 t[i] = t[p[i]]를 만족하는 s의 길이 n 부분 문자열을 표시한다.
문제
Let's suppose that we have fixed a permutation with length . We say that a string is a -drome if it has the length , and for all the characters of this string, it is true that .
You have a string and a permutation . For each substring of of length , you have to find out if it is a -drome or not.
입력
On the first line, you are given three integers , , and : the length of the permutation, the length of the string and the size of the alphabet of the string (; ).
On the second line, you are given integers : the permutation itsekf (; if ).
On the third line, you are given integers : the initial string ().
출력
Print characters without spaces: -th character must be "1" if substring is a -drome, and "0" otherwise.