codeforces#P1334G. Substring Search
Substring Search
Description
You are given a permutation consisting of exactly integers from to (since it is a permutation, each integer from to occurs in exactly once) and two strings and consisting of lowercase Latin letters.
A substring of string is an occurence of string if the following conditions are met:
- ;
- for each , either , or , where is the index of character in Latin alphabet (, , ).
For example, if , , , , , then three substrings of are occurences of (they are , and ).
For each substring of having length equal to , check if it is an occurence of .
The first line contains integers , , ..., (, all these integers are pairwise distinct).
The second line contains one string , and the third line contains one string () both consisting of lowercase Latin letters.
Print a string of characters, each character should be either 0 or 1. The -th character should be 1 if and only if the substring of starting with the -th character and ending with the -th character (inclusive) is an occurence of .
Input
The first line contains integers , , ..., (, all these integers are pairwise distinct).
The second line contains one string , and the third line contains one string () both consisting of lowercase Latin letters.
Output
Print a string of characters, each character should be either 0 or 1. The -th character should be 1 if and only if the substring of starting with the -th character and ending with the -th character (inclusive) is an occurence of .