Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题
2 seconds
256 megabytes
standard input
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.
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.
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).
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
MC 25 70
MC 42 82
CSKA 13 90 对于这种题,暴力扫一遍就好,有一个wa点就是每个人只用输出第一个
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
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[];
int kill[];
int main()
{
memset(kill,,sizeof(kill));
memset(kiss,,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]!=-)
kiss[w]++;
if(s=='r'&&kiss[w]!=-)
kiss[w]=;
if(kiss[w]==)
{
cout<<a<<" "<<w<<" "<<q<<endl;
kiss[w]=-;
}
}
if(m=='a')
{
if(s=='y'&&kill[w]!=-)
kill[w]++;
if(s=='r'&&kill[w]!=-)
kill[w]=;
if(kill[w]==)
{
cout<<b<<" "<<w<<" "<<q<<endl;
kill[w]=-;
}
}
}
return ;
}
Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题的更多相关文章
- 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 ... 
- 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 ... 
- Codeforces Round #281 (Div. 2) A. Vasya and Football(模拟)
		简单题,却犯了两个错误导致WA了多次. 第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的... 二是chronologically这个词 ... 
- Codeforces Round #281 (Div. 2) B. Vasya and Wrestling 水题
		B. Vasya and Wrestling 题目连接: http://codeforces.com/contest/493/problem/B Description Vasya has becom ... 
- 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 ... 
- 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 ... 
- 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 ... 
- 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 ... 
- 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 ... 
随机推荐
- innobackupex 相关语法讲解【转】
			innobackupex 相关语法讲解 连接服务器 The database user used to connect to the server and its password are speci ... 
- Windows Phone 8 获取设备名称
			通过使用Microsoft.Phone.Info.DeviceStatus类,我们可以获取设备的一些信息,如设备厂商,设备名称等.通过Microsoft.Phone.Info.DeviceStatus ... 
- python面向对象(三)之继承
			继承 介绍 继承是从已有的类中派生出新的类,新的类能吸收已有类的数据属性和行为,并能扩展新的能力.继承即常说的is-a关系.子类继承父类的特征和行为,使得子类具有父类的各种属性和方法.或子类从父类继承 ... 
- python类中的私有方法
			假设有如下一个python类: class Foo(object): def __a(self): print "Bet you can't see me..." def bar( ... 
- Python学习笔记:个税起征点上调至5000,算一算少交多少税?
			一.旧税率表与新税率表比较 以前起征点是3500,2018年10月1日起起征点正式修改为5000,下面我们用Python来分别计算新旧个人所得税分别为多少? 二.旧的个人所得税 import sys ... 
- JavaScript工程师都应懂的33个概念
			最近福利发的有点多啊,各种硬干货,小伙伴们是不是觉得很爽啊.Github真的蕴含着各种各样的宝藏,难怪各个大厂也都纷纷贡献自己的代码到Github上. 所以各种干货还是会源源不断的po给大家,觉得有帮 ... 
- day5模块学习--hashlib模块
			hashlib模块 Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度 ... 
- O(n log log n)实现FGT和FLT(Fast GCD/LCM Transformation)
			本文是作者看不懂分治FFT之后开始娱乐一下自己写的 看到一道题时候询问了正解后,推出了一个奇怪的变换,发现这个很Transformation,我和正解推出来的奇怪的东西是一样的,但还是想写一下思路.. ... 
- CentOS7.5安装与使用mysql-workbench
			1.下载 https://dev.mysql.com/downloads/workbench/ 要选开发版,通用版安装后要么闪退要么起不来 2.安装 rpm -ivh mysql-workbench- ... 
- 极简操作无需root隐藏S8导航栏和状态栏
			距离三星Galaxy S8国行发布快一个礼拜了,相信论坛不少小同伴已经拿到手,许多人和我一样被那块全视曲面屏给诱惑剁手的,当拿到手把玩一段时间后却發现这么美的一块屏幕居然大部分应用上下都有一行碍眼的状 ... 
