#ABC477D. 遮蔽胶带 / Masking Tape
遮蔽胶带 / Masking Tape
Problem Statement
There are squares arranged in a horizontal row, numbered square to square from left to right. Colors are represented by lowercase English letters.
Initially, the color of every square is a, and nothing is placed on any square.
You are given queries; process them in the given order. Each query is of one of the following two types:
1 X: If no tile is placed on square , place a tile on it; if a tile is placed on it, remove it.2 C: Change the color of every square on which no tile is placed to .
Find the color of each square after processing all queries (regardless of whether a tile is placed on it).
Constraints
- Each query is of type or type .
- In type- queries, is an integer satisfying .
- In type- queries, is a single lowercase English letter.
Input
The input is given from Standard Input in the following format:
Each query is given in the form
1 X
or
2 C
Output
Output the final colors of the squares as a string of length , concatenated from left to right.
3 5
1 2
2 b
1 1
1 2
2 c
bcc
We represent the state of tiles as a string formed by concatenating, from left to right, # if a tile is placed and . otherwise.
The queries change the colors of the squares and the state of tiles as follows. The initial state is aaa and ....
- Processing the -st query places a tile on square . The state becomes
aaaand.#.. - Processing the -nd query changes the color of the squares without tiles to
b. The state becomesbaband.#.. - Processing the -rd query places a tile on square . The state becomes
baband##.. - Processing the -th query removes the tile on square . The state becomes
baband#... - Processing the -th query changes the color of the squares without tiles to
c. The state becomesbccand#...
Thus, output bcc. A tile remains placed on square , but even in that case, output the color of the square.
10 15
1 8
2 m
1 3
1 10
2 q
1 6
1 10
2 d
1 1
2 z
1 9
2 f
1 4
1 7
2 k
dkmfkqfazk
- Source: AtCoder ABC 477 D
相关
在下列比赛中: