#ABC473F. A/AB 插入 / A/AB Insertion
A/AB 插入 / A/AB Insertion
Problem Statement
You are given a string of length consisting of A and B.
Process a total of queries of the following types.
1 i c
Type : Change the -th character of to .
2 l r
Type :
Let string be the string obtained by extracting the -th through -th characters of the current string .
If it is possible to obtain string by the following operation, output Yes; otherwise, output No.
- Starting from the empty string, perform the following two operations any number of times, possibly zero, in any order.
- Choose any position in the string (possibly the beginning or the end) and insert
Athere. - Choose any position in the string (possibly the beginning or the end) and insert
ABthere.
- Choose any position in the string (possibly the beginning or the end) and insert
Constraints
- is an integer satisfying .
- is a string of length consisting of
AandB. - is an integer satisfying .
- Each given query is of type or .
- Queries of type satisfy the following constraints:
- is an integer satisfying , and
- is
AorB.
- Queries of type satisfy the following constraints:
- and are integers satisfying .
Input
The input is given from Standard Input in the following format:
Here, represents the -th query, and the input format for a query follows the format described in the problem statement.
Output
Each time a query of type is given, output the answer on one line.
10
AABBAABABB
6
2 1 10
1 5 B
2 1 10
2 6 8
1 3 A
2 1 10
Yes
No
Yes
Yes
This input contains six queries.
-
Initially,
AABBAABABB. -
For the -st query,
AABBAABABB, obtained by extracting the -st through -th characters of , can be obtained by the following steps, so outputYes. -
Start from the empty string.
-
Insert
ABat the beginning of the empty string, making the stringAB. -
Insert
ABright after the -st character ofAB, making the stringAABB. -
Insert
ABat the end ofAABB, making the stringAABBAB. -
Insert
ABright after the -th character ofAABBAB, making the stringAABBAABB. -
Insert
ABright after the -th character ofAABBAABB, making the stringAABBAABABB. -
For the -nd query, change the -th character of to
B. As a result,AABBBABABB. -
For the -rd query,
AABBBABABB, obtained by extracting the -st through -th characters of , cannot be obtained by the operation described in the problem statement, so outputNo. -
For the -th query,
ABA, obtained by extracting the -th through -th characters of , can be obtained by the operation described in the problem statement, so outputYes. -
For the -th query, change the -rd character of to
A. As a result,AAABBABABB. -
For the -th query,
AAABBABABB, obtained by extracting the -st through -th characters of , can be obtained by the operation described in the problem statement, so outputYes. -
Source: AtCoder ABC 473 F
相关
在下列比赛中: