#abc285f. F - Substring of Sorted String
F - Substring of Sorted String
Score : points
问题描述
你将获得一个长度为 的由小写英文字母组成的字符串 ,以及 个查询。请按照顺序处理这些查询。
每个查询属于以下两种类型之一:
1 x c
:将 中的第 个字符替换为字符 。2 l r
:对 中的字符进行升序排序得到字符串 。如果 中从第 个到第 个字符组成的子串是 的子串,则输出Yes
;否则输出No
。
什么是子串?子串是指通过从 中移除 个或多个首部字符及 个或多个尾部字符后得到的字符串。例如,ab
是 abc
的子串,而 ac
不是 abc
的子串。
以上为通义千问 qwen-max 翻译,仅供参考。
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 is a string obtained by removing or more initial characters and or more final characters of . 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.
Sample Input 1
6
abcdcf
4
2 1 3
2 2 6
1 5 e
2 2 6
Sample Output 1
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.
update @ 2024/3/10 11:56:13