CF493A.Vasya and Football

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.

Vasya is watching a recorded football match now and makes notes of all the fouls that he would give a card for. Help Vasya determine all the moments in time when players would be given red cards if Vasya were the judge. For each player, Vasya wants to know only the first moment of time when he would receive a red card from Vasya.

瓦西娅开始观看足球比赛。他了解到,对于某些犯规,球员会收到黄牌;而对于另一些犯规,则会收到红牌。一名球员在收到第二张黄牌后,将自动收到一张红牌。

瓦西娅正在观看一场录播的足球比赛,并记录下他判定应出示牌的所有犯规。请帮助瓦西娅确定:如果由瓦西娅担任裁判,球员们会在哪些时刻被出示红牌。对于每名球员,瓦西娅只想知道他首次被瓦西娅出示红牌的时刻。

输入格式

The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct.

Next follows number n (1 ≤ n ≤ 90) — the number of fouls.

Each of the following n lines contains information about a foul in the following form:

  • first goes number t (1 ≤ t ≤ 90) — the minute when the foul occurs;
  • then goes letter "h" or letter "a" — if the letter is "h", then the card was given to a home team player, otherwise the card was given to an away team player;
  • then goes the player's number m (1 ≤ m ≤ 99);
  • then goes letter "y" or letter "r" — if the letter is "y", that means that the yellow card was given, otherwise the red card was given.

The players from different teams can have the same number. The players within one team have distinct numbers. The fouls go chronologically, no two fouls happened at the same minute.

第一行包含主场球队的名称。
第二行包含客场球队的名称。
两行均非空,且长度均不超过 20。每行仅由大写英文字母组成。两支队伍的名称互不相同。

接下来是一个整数 $ n (( 1 \leq n \leq 90 $)——表示犯规次数。

随后的 $ n $ 行中,每行描述一次犯规,格式如下:

  • 首先是一个整数 $ t (( 1 \leq t \leq 90 $)——表示犯规发生的分钟数;
  • 然后是一个字母 "h" 或 "a"——若为 "h",表示黄牌或红牌发给了主场球队球员;若为 "a",则发给了客场球队球员;
  • 接着是一个球员号码 $ m (( 1 \leq m \leq 99 $);
  • 最后是一个字母 "y" 或 "r"——若为 "y",表示给出的是黄牌;若为 "r",表示给出的是红牌。

不同球队的球员可以拥有相同的号码;但同一支球队内的球员号码互不相同。所有犯规按时间顺序给出,不存在同一分钟发生两次犯规的情况。

输出格式

For each event when a player received his first red card in a chronological order print a string containing the following information:

  • The name of the team to which the player belongs;
  • the player's number in his team;
  • the minute when he received the card.

If no player received a card, then you do not need to print anything.

It is possible case that the program will not print anything to the output (if there were no red cards).

对于每位球员首次收到红牌的事件,按时间顺序输出一个字符串,其中包含以下信息:

  • 该球员所属球队的名称;
  • 该球员在其球队中的号码;
  • 他收到红牌的分钟数。

如果没有球员收到红牌,则无需输出任何内容。

存在程序不向输出中打印任何内容的可能性(即没有红牌发生)。

输入输出样例

  • 输入#1

    MC
    CSKA
    9
    28 a 3 y
    62 h 25 y
    66 h 42 y
    70 h 25 y
    77 a 4 y
    79 a 25 y
    82 h 42 r
    89 h 16 y
    90 a 13 r

    输出#1

    MC 25 70
    MC 42 82
    CSKA 13 90

输入解题思路,AI测评打分。不知道怎么写?

首页