La Vie En Rose

아직 제출이 없습니다시간 제한2.5초메모리 제한64 MB

문제

Professor Zhang would like to solve the multiple pattern matching problem, but he only has only one pattern string p=p_1p_2p_mp = p\_{1} p\_{2} \ldots p\_{m}. So, he wants to generate as many pattern strings as possible from pp using the following method: 

  1. select some indices i_1,i_2,,i_ki\_1, i\_2, \ldots, i\_k such that 1i_1<i_2<<i_k<p1 \le i\_1 < i\_2 < \ldots < i\_k < |p| and i_ji_j+1>1|i\_{j} - i\_{j + 1}| > 1 for all 1j<k1 \le j < k.
  2. swap p_i_jp\_{i\_{j}} and p_i_j+1p\_{i\_{j} + 1} for all 1jk1 \le j \le k.

Now, for a given a string s=s_1s_2s_ns = s\_{1} s\_{2} \ldots s\_{n}, Professor Zhang wants to find all occurrences of all the generated patterns in ss.

입력

The first line contains two integers nn and mm (1n1051 \le n \le 10^5, 1mmin(50,000,n)1 \le m \le \min (50\\,000, n)): the lengths of ss and pp, respectively.

The second line contains the string ss, and the third line contains the string pp. Both strings consist only of lowercase English letters.

출력

Output a binary string of length nn. The ii-th character must be '1' if and only if the substring s_is_i+1s_i+m1s\_{i} s\_{i+1} \ldots s\_{i+m-1} is one of the generated patterns. Otherwise, the character must be '0'.