atcoder#ABC285F. [ABC285F] Substring of Sorted String
[ABC285F] Substring of Sorted String
Score : points
Problem Statement
You are given a string of length consisting of lowercase English letters, and queries. Process the queries in order.
Each query is of one of the following two kinds:
1 x c
: replace the -th character of by the character .2 l r
: let be the string obtained by sorting the characters of in ascending order. PrintYes
if the string consisting of the -th through -th characters of is a substring of ; printNo
otherwise.
What is a substring?
A substring of S is a string obtained by removing 0 or more initial characters and 0 or more final characters of S. For example,ab
is a substring of abc
, while ac
is not a substring of abc
.
Constraints
- is a string of length consisting of lowercase English letters.
- For each query of the first kind, .
- For each query of the first kind, is a lowercase English letter.
- For each query of the second kind, .
Input
The input is given from Standard Input in the following format, where denotes the -th query:
Output
Process the queries as instructed in the Problem Statement.
6
abcdcf
4
2 1 3
2 2 6
1 5 e
2 2 6
Yes
No
Yes
- In the -st query,
abccdf
is the string obtained by sorting the characters of in ascending order. The stringabc
, consisting of the -st through -rd characters of , is a substring of , soYes
should be printed. - In the -nd query,
abccdf
is the string obtained by sorting the characters of in ascending order. The stringbcdcf
, consisting of the -nd through -th characters of , is not a substring of , soNo
should be printed. - The -rd query sets the -th character of to
e
, makingabcdef
. - In the -th query,
abcdef
is the string obtained by sorting the characters of in ascending order. The stringbcdef
, consisting of the -nd through -th characters of , is a substring of , soYes
should be printed.