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. Android studio & SDK的国内有效站点。

    SDK.TOOLS的国内有效镜像节点: mirrors.zzu.edu.cn/android/repository/ 网上的地址只写了mirrors.zzu.edu.cn,有误,需要补齐后面的子目录才 ...

  2. [Windows Server 2008] Apache+PHP安全设置

    ★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:Win2008 ...

  3. easyui 使用笔记

    http://www.easyui.info/archives/1435.html datagrid 服务端分页 服务端分页,高效,快捷!强力推荐! easyui的datagrid服务端分页,通过设置 ...

  4. Caffe RPN :error C2220: warning treated as error - no 'object' file generated

    在 caffe里面添加rpn_layer.cpp之后,总是出现 error C2220: warning treated as error - no 'object' file generated 这 ...

  5. 配置Android的NDK开发环境(eclipse)

    ndk下载地址: http://blog.csdn.net/zhanghuoding/article/details/51345256 在eclipse设置ndk位置 右键你的工程,android t ...

  6. ESLint =》tslint.json

    结论:将ESLint提示注意()里面的规则属性在tslint.json中"rules": { } 里设置为false 1.ES6: ESLint提示"Require Ob ...

  7. NGINX+PHP-FPM7 FastCGI sent in stderr: “Primary script unknown”

    https://www.cnblogs.com/hjqjk/p/5651275.html 一开始是Nginx打开网页显示一直是拒绝访问.查看nginx日志是报错显示我的题目,然后就各种搜索解决啊! 百 ...

  8. 数据结构与算法(5) -- deque

    vector是单向开口的连续线性空间,deque则是一种双向开口的连续线性空间.所谓双向开口,意思是可以在头尾两端分别做元素的插入和删除操作.stl中deque与vector最大的差异,一在于dequ ...

  9. zend studio【快捷键】

    =================================[快捷键 zend studio]========== 1.调出查找面板[ctrl+f] 2.全文检索[ctrl+h] 3.关闭当前文 ...

  10. ansible special topics

    1.加速模式运行playbook accelerate 对于使用ansible 1.5 及之后版本的用户,加速模式只在以下情况下有用处: (A) 管理红帽企业版 Linux 6 或者更早的那些依然使用 ...