#ABC475E. 问答预赛晋级者 / Quiz Competition: Qualifiers
问答预赛晋级者 / Quiz Competition: Qualifiers
Problem Statement
A preliminary round of a quiz competition was held. There are participants, numbered to , and at most of them can pass the preliminary round.
The preliminary round consists of two-choice quiz questions, and the answer to each question is o or x. Participant 's answer to the -th question is given as the -th character of the string . The correct answer to the -th question is given as the -th character of the string .
The qualifiers are determined by the following procedure.
- Initially, the numbers of qualifiers and non-qualifiers are both ; all participants are undetermined.
- For in this order, perform the following process.
- If the number of qualifiers plus the number of undetermined participants who answered the -th question correctly is at most , then all undetermined participants who answered the -th question correctly become qualifiers.
- Otherwise, all undetermined participants who answered the -th question incorrectly become non-qualifiers.
- All remaining undetermined participants become non-qualifiers.
You are given queries in the following format. Process them in order.
- Integers and are given. Change participant 's answer to the -th question from
otox, or fromxtoo. Then, determine whether participant passes the preliminary round.
The change of the answer in each query remains in effect when processing subsequent queries as well.
Constraints
- and are strings of length consisting of
oandx. - For each query, and .
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Here, represents the -th query, and is given in the following format:
Output
Output lines. The -th line should contain Yes if the participant specified in the -th query passes the preliminary round, and No otherwise.
5 3 3
oxo
oxo
oxx
xxo
xox
xoo
3
5 1
1 3
4 1
Yes
Yes
No
- Before the first query, participants pass on the first question and participant passes on the second question, so the qualifiers are the three participants .
- After the first query, participants pass on the first question, so the qualifiers are the three participants . Since participant passes the preliminary round, output
Yes. - After the second query, participants still pass on the first question, so the qualifiers are the three participants . Since participant passes the preliminary round, output
Yes. - After the third query, participant is eliminated on the first question, participants pass on the second question, and participant passes on the third question, so the qualifiers remain the three participants . Since participant does not pass the preliminary round, output
No.
3 1 2
ox
xo
oo
ox
4
3 1
1 1
2 2
1 2
No
No
Yes
No
1 1 1
o
o
2
1 1
1 1
No
Yes
- Source: AtCoder ABC 475 E
相关
在下列比赛中: