A. Vasya and Football
 

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 thefirst moment 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

 题意:两个足球队进行比赛 给你n个黄红牌,两张黄牌=一张红牌=罚下场。问你随着时间递增,出现罚下的情况

题解

不要重复输出罚下相同一个人的情况就是了,暴力

///meek
#include<bits/stdc++.h>
using namespace std; typedef long long ll;
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){
if(ch=='-')f=-;ch=getchar();
}
while(ch>=''&&ch<=''){
x=x*+ch-'';ch=getchar();
}return x*f;
}
//****************************************
const int N=;
#define mod 10000007
#define inf 10000007
#define maxn 10000
char h[],a[],ch[],ch2[]; map<string,string> mp;
map<string,int>mps;
int HH[];
int AH[];
int u[];
int main() {
mem(HH),mem(AH);mp.clear();
scanf("%s%s",h,a);
int n=read(),t,num;
for(int i=;i<=n;i++) {
scanf("%d%s%d%s",&t,ch,&num,ch2);
if(ch2[]=='y') {
if(ch[]=='a') {
AH[num]++;
if(AH[num]>) continue;
if(AH[num]==) {
cout<<a<<" "<<num<<" "<<t<<endl;
}
}
else {
HH[num]++;
if(HH[num]>) continue;
if(HH[num]==) {
cout<<h<<" "<<num<<" "<<t<<endl;
}
}
}
else {
if(ch[]=='a') {
if(AH[num]>=)continue;
AH[num]+=;
cout<<a<<" "<<num<<" "<<t<<endl;
}
else {
if(HH[num]>=)continue;
HH[num]+=;
cout<<h<<" "<<num<<" "<<t<<endl;
}
}
}
return ;
}

代码

Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力的更多相关文章

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

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

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

  3. Codeforces Round #281 (Div. 2) B. Vasya and Wrestling 水题

    B. Vasya and Wrestling 题目连接: http://codeforces.com/contest/493/problem/B Description Vasya has becom ...

  4. Codeforces Round #281 (Div. 2) D. Vasya and Chess 水

    D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分

    C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  6. Codeforces Round #281 (Div. 2) D. Vasya and Chess 镜面对称 博弈论

    D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  7. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 暴力水题

    C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  8. Codeforces Round #281 (Div. 2) D. Vasya and Chess 博弈

    D. Vasya and Chess   Vasya decided to learn to play chess. Classic chess doesn't seem interesting to ...

  9. Codeforces Round #281 (Div. 2) C. Vasya and Basketball 排序

    C. Vasya and Basketball   Vasya follows a basketball game and marks the distances from which each te ...

随机推荐

  1. D3.js 力导向图(小气泡围绕中心气泡)

    html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3 ...

  2. java学习笔记_网络

    客户端 import java.io.*; import java.net.*; public class DailyAdviceClient { public void go() { try { S ...

  3. 【java并发容器】并发容器之CopyOnWriteArrayList

    原文链接: http://ifeve.com/java-copy-on-write/ Copy-On-Write简称COW,是一种用于程序设计中的优化策略.其基本思路是,从一开始大家都在共享同一个内容 ...

  4. dedecms:解析Robots.txt 协议标准

    Robots.txt 是存放在站点根目录下的一个纯文本文件.虽然它的设置很简单,但是作用却很强大.它可以指定搜索引擎蜘蛛只抓取指定的内容,或者是禁止搜索引擎蜘蛛抓取网站的部分或全部内容. 下面我们就来 ...

  5. DetachedCriteria和Criteria的使用方法

    DetachedCriteria和Criteria的使用方法 /*  * 下载统计  * @return  */ public String downloadStatistics(){  logger ...

  6. mysql下载和安装Windows服务

    一.下载mysql:https://dev.mysql.com/downloads/mysql/,解压拷贝到D:\software\mysql-8.0.13-winx64 二.在D:\software ...

  7. OpenGL第23-26小结

    到后面代码相对而言比较复杂了,因为没有系统的看红宝书(就跟字典一样,兴趣缺缺),很多操作的步骤比较迷糊. 23讲讲解了如何将环境纹理贴在球体.圆柱体等非矩形物体表面,从而达到一个反射周围景色的效果(恩 ...

  8. GCD & Operation queues & Thread

    One of the technologies for starting tasks asynchronously is Grand Central Dispatch (GCD). This tech ...

  9. C# Winform 最大化后 任务栏还显示解决

    //最大化 this.WindowState = FormWindowState.Maximized; //窗体最大化时 非全屏 不会遮盖任务栏 //去掉标题栏 this.FormBorderStyl ...

  10. 【原创】基于NodeJS Express框架开发的一个VIP视频网站项目及源码分享

    项目名称:视频网站项目 开发语言:HTML,CSS(前端),JavaScript,NODEJS(expres)(后台) 数据库:MySQL 开发环境:Win7,Webstorm 上线部署环境:Linu ...