博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题
阅读量:6677 次
发布时间:2019-06-25

本文共 2998 字,大约阅读时间需要 9 分钟。

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 first 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 对于这种题,暴力扫一遍就好,有一个wa点就是每个人只用输出第一个
#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
typedef long long ll;using namespace std;//freopen("D.in","r",stdin);//freopen("D.out","w",stdout);#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)int kiss[100];int kill[100];int main(){ memset(kill,0,sizeof(kill)); memset(kiss,0,sizeof(kiss)); string a,b; cin>>a>>b; int n; cin>>n; while(n--) { int q,w; char m,s; cin>>q>>m>>w>>s; if(m=='h') { if(s=='y'&&kiss[w]!=-1) kiss[w]++; if(s=='r'&&kiss[w]!=-1) kiss[w]=2; if(kiss[w]==2) { cout<
<<" "<
<<" "<
<

 

转载地址:http://epyao.baihongyu.com/

你可能感兴趣的文章
2006下半年程序员级试题答案
查看>>
redis命令中文手册
查看>>
XenApp 发布应用,访问比较慢
查看>>
CMMI三级的一些重点总结
查看>>
JavaScript语言基础知识点总结(思维导向图)
查看>>
我的友情链接
查看>>
*.hbm.xml文件——单表映射、双向多对一以及多对多的配置
查看>>
robocopy和计划任务并用实现文件服务器每天自动备份
查看>>
在老男孩教育学习的三个月
查看>>
Java GC 日志详解
查看>>
让 CentOS 使用 yum
查看>>
kali——google安装
查看>>
xp vista win7多系统并存攻略
查看>>
blob 导出csv 用execl打开出现乱码
查看>>
Python 函数
查看>>
如何设置nginx缓存
查看>>
谷歌2013校招全套笔试题
查看>>
宅男程序员给老婆的计算机课程
查看>>
我的友情链接
查看>>
脚本实现CA的制作以及证书的颁发
查看>>