102921: [Atcoder]ABC292 B - Yellow and Red Card
Description
Score : $200$ points
Problem Statement
$N$ players numbered $1$ to $N$ will play a soccer game.
When a player commits an offense, that player will receive a yellow card or a red card.
A player who satisfies one of the following conditions will be removed from the game.
- Accumulates two yellow cards.
- Receives a red card.
Once a player is removed, that player will no longer receive any cards.
You will watch this game. Initially, the players have not received any cards.
There will be $Q$ events. Correctly answer the questions asked in the events.
There are three kinds of events, which are given in the format c x
from the input, where $c$ is $1$, $2$, or $3$. The events are as follows.
1 x
: Player $x$ receives a yellow card.2 x
: Player $x$ receives a red card.3 x
: You are asked whether player $x$ has been removed from the game. AnswerYes
orNo
.
Constraints
- $1 \leq N \leq 100$
- $1 \leq Q \leq 100$
- $1 \leq x \leq N$ in all events.
- There is at least one event of the third kind.
- A player who has been removed will no longer receive any cards.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format, where $\text{event}_i$ denotes the $i$-th event.
$N$ $Q$ $\text{event}_1$ $\text{event}_2$ $\vdots$ $\text{event}_Q$
Each event is in one of the following formats:
1 $x$
2 $x$
3 $x$
Output
Print $X$ lines, where $X$ is the number of events of the third kind in the input.
The $i$-th line should contain Yes
if, for the $i$-th event of the third kind, player $x$ has been removed from the game, and No
otherwise.
Sample Input 1
3 9 3 1 3 2 1 2 2 1 3 1 3 2 1 2 3 2 3 3
Sample Output 1
No No Yes No Yes No
Here are all the events in chronological order.
In the $1$-st event, you are asked whether player $1$ has been removed from the game. Player $1$ has not been removed, so you should print No
.
In the $2$-nd event, you are asked whether player $2$ has been removed from the game. Player $2$ has not been removed, so you should print No
.
In the $3$-rd event, player $2$ receives a yellow card.
In the $4$-th event, player $1$ receives a red card and is removed from the game.
In the $5$-th event, you are asked whether player $1$ has been removed from the game. Player $1$ has been removed, so you should print Yes
.
In the $6$-th event, you are asked whether player $2$ has been removed from the game. Player $2$ has not been removed, so you should print No
.
In the $7$-th event, player $2$ receives a yellow card and is removed from the game.
In the $8$-th event, you are asked whether player $2$ has been removed from the game. Player $2$ has been removed, so you should print Yes
.
In the $9$-th event, you are asked whether player $3$ has been removed from the game. Player $3$ has not been removed, so you should print No
.
Input
题意翻译
$N$ 名选手进行足球比赛。选手犯规时会被出示黄牌或红牌,当累计被出示两次黄牌或被出示红牌是选手会被罚下场。 比赛时会发生 $Q$ 个事件,事件有三种: 1. 输入 $1$ $x$,表示选手 $x$ 被出示黄牌。 1. 输入 $2$ $x$,表示选手 $x$ 被出示红牌。 1. 输入 $3$ $x$,询问选手 $x$ 是否被罚下场。若被罚下场,输出 `Yes`,否则输出 `No`。Output
问题描述
$N$个编号为$1$到$N$的球员将参加一场足球比赛。
当一名球员犯规时,该球员将收到一张 黄牌 或 红牌 。
满足以下条件之一的球员将被 罚下场 。
- 累积两张黄牌。
- 收到一张红牌。
一旦球员被罚下场,该球员将不再收到任何牌。
你将观看这场比赛。起初,球员们没有收到任何牌。
将有$Q$个事件。正确回答事件中提出的问题。
事件有三种类型,输入中给出的格式为c x
,其中$c$为$1$,$2$或$3$。事件如下。
1 x
:球员$x$收到一张黄牌。2 x
:球员$x$收到一张红牌。3 x
:询问球员$x$是否已被罚下场。回答Yes
或No
。
约束
- $1 \leq N \leq 100$
- $1 \leq Q \leq 100$
- 所有事件中,$1 \leq x \leq N$。
- 至少有一个第三种类型的事件。
- 被罚下场的球员将不再收到任何牌。
- 输入中的所有值都是整数。
输入
输入从标准输入按以下格式给出,其中$\text{event}_i$表示第$i$个事件。
$N$ $Q$ $\text{event}_1$ $\text{event}_2$ $\vdots$ $\text{event}_Q$
每个事件有以下格式之一:
1 $x$
2 $x$
3 $x$
输出
打印$X$行,其中$X$是输入中第三种类型的事件的数量。
对于第$i$个第三种类型的事件,如果球员$x$已被罚下场,则第$i$行应包含Yes
,否则为No
。
样例输入1
3 9 3 1 3 2 1 2 2 1 3 1 3 2 1 2 3 2 3 3
样例输出1
No No Yes No Yes No
以下是按时间顺序排列的所有事件。
在第$1$个事件中,询问球员$1$是否已被罚下场。球员$1$没有被罚下场,所以你应该打印No
。
在第$2$个事件中,询问球员$2$是否已被罚下场。球员$2$没有被罚下场,所以你应该打印No
。
在第$3$个事件中,球员$2$收到一张黄牌。
在第$4$个事件中,球员$1$收到一张红牌并被罚下场。
在第$5$个事件中,询问球员$1$是否已被罚下场。球员$1$已被罚下场,所以你应该打印Yes
。
在第$6$个事件中,询问球员$2$是否已被罚下场。球员$2$没有被罚下场,所以你应该打印No
。
在第$7$个事件中,球员$2$收到一张黄牌并被罚下场。
在第$8$个事件中,询问球员$2$是否已被罚下场。球员$2$已被罚下场,所以你应该打印Yes
。
在第$9$个事件中,询问球员$3$是否已被罚下场。球员$3$没有被罚下场,所以你应该打印No
。