A. Vasya and Football
time limit per test 2 seconds
memory limit per test 256 megabytes
input standard input
output standard output

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 firstmoment of time when he would receive a red card from Vasya.

Input

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.

Output

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).

Sample test(s)
input
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
output
MC 25 70
MC 42 82
CSKA 13 90

这模拟题……也是醉了

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<ctime>
#define LL long long
#define inf 0x7ffffff
#define pa pair<int,int>
#define pi 3.1415926535897932384626433832795028841971
using namespace std;
inline LL read()
{
LL x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
struct foul{int x,y;char a[5],b[5];}f[10010];bool operator <(foul a,foul b){return a.x<b.x;}
char c1[10010],c2[10010];
int gc[1000];
int n;
int main()
{
scanf("%s%s",c1,c2);
n=read();
for(int i=1;i<=n;i++)
{
int x,y;
char a[5],b[5];
f[i].x=read();
scanf("%s",f[i].a);
f[i].y=read();
scanf("%s",f[i].b);
if (f[i].a[0]=='a')f[i].y+=100;
}
sort(f+1,f+n+1);
for (int i=1;i<=n;i++)
{
if (f[i].b[0]=='r')gc[f[i].y]+=2;
else gc[f[i].y]++;
if (gc[f[i].y]>=2)
{
if (f[i].y<100)
printf("%s %d %d\n",c1,f[i].y%100,f[i].x);
else printf("%s %d %d\n",c2,f[i].y%100,f[i].x);
gc[f[i].y]=-100000;
}
}
return 0; }

cf493A Vasya and Football的更多相关文章

  1. CF493A Vasya and Football 题解

    Content 有两个球队在踢足球,现在给出一些足球运动员被黄牌或红牌警告的时间,求每个队员第一次被红牌警告的时间. 注意:根据足球比赛规则,两张黄牌自动换成一张红牌. 数据范围:比赛时间 \(90\ ...

  2. A. Vasya and Football

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  3. Codeforces Round #281 (Div. 2) A. Vasya and Football 模拟

    A. Vasya and Football 题目连接: http://codeforces.com/contest/493/problem/A Description Vasya has starte ...

  4. Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  5. Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力

    A. Vasya and Football   Vasya has started watching football games. He has learned that for some foul ...

  6. codeforces 493A. Vasya and Football 解题报告

    题目链接:http://codeforces.com/contest/493/problem/A 题目意思:给出两个字符串,分别代表 home 和 away.然后有 t 个player,每个playe ...

  7. Codeforces Round #281 (Div. 2) A. Vasya and Football(模拟)

    简单题,却犯了两个错误导致WA了多次. 第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的... 二是chronologically这个词 ...

  8. Codeforces Round #281 (Div. 2)

    题目链接:http://codeforces.com/contest/493 A. Vasya and Football Vasya has started watching football gam ...

  9. Codeforces Round #281 (Div. 2) A 模拟

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

随机推荐

  1. Filebeat中文指南

    Filebeat中文指南 翻译自:https://www.elastic.co/guide/en/beats/filebeat/current/index.html 译者:kerwin 鸣谢:tory ...

  2. HDU 1501 & POJ 2192 Zipper(dp记忆化搜索)

    题意:给定三个串,问c串是否能由a,b串任意组合在一起组成,但注意a,b串任意组合需要保证a,b原串的顺序 例如ab,cd可组成acbd,但不能组成adcb. 分析:对字符串上的dp还是不敏感啊,虽然 ...

  3. 宙斯是一个完整的Hadoop的作业平台[转]

    https://github.com/alibaba/zeus 宙斯(zeus)是什么 宙斯是一个完整的Hadoop的作业平台从Hadoop任务的调试运行到生产任务的周期调度 宙斯支持任务的整个生命周 ...

  4. Qt Creator实现状态栏显示

    在程序主窗口Mainwindow中,有菜单栏,工具栏,中心部件和状态栏.前面几个已经讲过了,这次讲解状态栏的使用. 程序中有哪些不明白的类或函数,请自己查看帮助. 1.我们在mainwindow.h中 ...

  5. Vim的设置和使用——编程者

    一.第一个插件:Ctags 当我们看到一个陌生的变量或者函数,我们总想知道它的含义,因此,快速找到它的定义很重要.Ctags插件中的"Ctrl+]"快捷键就可以做到. 二.教你高效 ...

  6. CentOS7 安装chrome浏览器

    本篇文章主要记录如何在CentOS7.0上安装chrome. 1.配置yum下载源: 在目录 /etc/yum.repos.d/ 下新建文件 google-chrome.repo, 并且在该文件中添加 ...

  7. linux命令帮助

    Linux命令格式:command [options] [arguments]command:命令options: 参数 [] 表示是可选的;<> 表示是可变化的; x|y|z 表示只能选 ...

  8. linux cat /proc/cpuinfo

    #cat /proc/cpuinfo processor : 0 #逻辑处理器的唯一标识符 vendor_id : AuthenticAMD #CPU厂商ID信息,如果处理器为英特尔处理器,则vend ...

  9. [转] iOS性能优化技巧

    (转自:hhttp://www.raywenderlich.com/31166/25-ios-app-performance-tips-tricks#arc, http://blog.ibireme. ...

  10. WPF之Binding的使用

    引出: 在WPF中Binding可以比作数据的桥梁,桥梁的两端分别是Binding的源(Source)和目标(Target).一般情况下,Binding源是逻辑层对象,Binding目标是UI层的控件 ...