#P10273. 大娱乐至上
大娱乐至上
Background
Glitter, black holes, the star that everyone watches.
In the most beautiful dream of the most beautiful land.
Her hair is more expensive than gold leaf, her lipprints can be worth bundles of cash.
But her heart, her heart, her heart,
Is not worth a single gold coin, not worth a single gold coin, not worth a glance.
Problem Description
You are given a string of length consisting of lowercase letters, and a binary string of length . means that can be modified.
You are given substrings . A substring is defined to be non-partially-ordered if and only if it is possible to modify at most one position of so that, among the substrings, all substrings that were originally become .
Formally, a pair is non-partially-ordered if and only if there exists a string (obtained from by modifying at most one character) such that $\forall\,1 \le j \le m,[S_{[l_j,r_j]}<S_{[l_i,r_i]}]+[T_{[l_j,r_j]}<T_{[l_i,r_i]}]\not=2$.
Determine which substrings are non-partially-ordered.
Note that after modification, characters smaller than a or larger than z are allowed.
Input Format
The first line contains two integers .
The second line contains a string .
The third line contains a binary string .
The next lines each contain a pair .
Output Format
Output a binary string of length . means that is non-partially-ordered, and means it is not.
10 5
abbaababaa
0111111111
1 5
7 10
1 3
3 7
4 8
01111
Hint
Explanation of Sample 1
For convenience, assume the character smaller than a is #, and the character larger than z is *.
-
No matter how you modify, it always holds that .
-
can be
abbcababaa. -
can be
a#baababaa. -
can be
ab#aababaa. -
can be
abbaababaa.
Constraints and Notes
This problem uses bundled testdata.
.
.
.
No special restrictions.
For all testdata, . All inputs are integers and lowercase letters.
Translated by ChatGPT 5