#abc331f. F - Palindrome Query
F - Palindrome Query
Score : points
问题描述
你将得到一个长度为 的由小写英文字母组成的字符串 。
按照给定顺序处理 个查询。查询有两种类型:
1 x c
:将字符串 中的第 个字符更改为小写英文字母 。2 L R
:如果由字符串 中从第 个到第 个字符组成的子串是一个回文串,则输出Yes
;否则,输出No
。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a string of length consisting of lowercase English letters.
Process queries described below in the order they are given.
There are two types of queries:
1 x c
: Change the -th character of to the lowercase English letter .2 L R
: If the substring formed by the -th through -th characters of is a palindrome, printYes
; otherwise, printNo
.
Constraints
- is a string of length consisting of lowercase English letters.
- is a lowercase English letter.
- are integers.
Input
The input is given from Standard Input in the following format. Here, is the -th query to be processed.
Each query is given in one of the following formats:
Output
Follow the instructions in the problem statement and print the answers to the queries, separated by newlines.
Sample Input 1
7 8
abcbacb
2 1 5
2 4 7
2 2 2
1 5 c
2 1 5
2 4 7
1 4 c
2 3 6
Sample Output 1
Yes
No
Yes
No
Yes
Yes
Initially, abcbacb
.
For the first query, the string formed by the -st through -th characters of is abcba
, which is a palindrome. Thus, print Yes
.
For the second query, the string formed by the -th through -th character of is bacb
, which is not a palindrome. Thus, print No
.
For the third query, the string formed by the -nd through -nd character of is b
, which is a palindrome. Thus, output Yes
.
For the fourth query, change the -th character of to c
. becomes abcbccb
.
For the fifth query, the string formed by the -st through -th character of is abcbc
, which is not a palindrome. Thus, output No
.
For the sixth query, the string formed by the -th through -th character of is bccb
, which is a palindrome. Thus, output Yes
.
For the seventh query, change the -th character of to c
. becomes abccccb
.
For the eighth query, the string formed by the -rd through -th character of cccc
, which is a palindrome. Thus, output Yes
.
update @ 2024/3/10 01:16:08