Codeforces Round #281 (Div. 2) 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.
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
题意:两个足球队进行比赛 给你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 暴力的更多相关文章
- 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 ...
- 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) 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 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 ...
随机推荐
- JavaScript入门笔记
第一章 JavaScript语法 1.1 初识JavaScript 1.3 数据类型 1.4 string和boolean类型 1.5 算数操作符 第二章 JavaScript流程控制语句 2.1 循 ...
- 在ubuntu系统下下载和卸载skype
1.下载 sudo apt-get install skypeforlinux 2.卸载 sudo apt remove skypeforlinux
- Android 使用MySQL直接访问数据库
在实际项目中,一般很少直接访问MySQL数据库,一般情况下会通过http请求将数据传送到服务端,然后在服务端连接mysql数据库. 在android 中,会通过使用Jdbc 连接MySQL 服务器 p ...
- CloseableHttpClient 在使用过程中遇到的问题
代码是前辈写的,在对代码进行压测的时候遇到了个问题,最大线程是 不能超过setDefaultMaxPerRoute设置的数字,一点超过 就会死掉.这里会报错 connection pool shut ...
- 远程连接阿里云服务器ping不通ip解决方案
搭建了阿里云服务器,发现本地ping不通,查看半天才发现,原来是在阿里云上的安全组少了些东西. 在出入方向上新建一个安全组,就可以搞定了.
- 最快的 Python Web 框架入门
速度比较 框架 实现基础 每秒请求数 平均时间 Sanic Python 3.5 + uvloop 30,601 3.23ms Wheezy gunicorn + meinheld 20,244 4. ...
- IE低版本和高级浏览器对文本输入事件兼容
1 一般 使用oninput 事件可以监控文本输入事实触发 2 兼容需要使用onpropertychange . 3 兼容写法 var evenInput=DOM元素.oninput || DOM ...
- Going Home HDU - 1533(最大费用最小流)
On a grid map there are n little men and n houses. In each unit time, every little man can move one ...
- isinstance、issubclass、反射
一.isinstance.issubclass # isinstance(obj, cls) 检查obj是否是cls的对象 class A(object):pass a = A() print(isi ...
- 21.使用rescoring机制优化近似匹配搜索性能
一.match和phrase match(proximity match)区别 1.match:只要简单的匹配到了一个term,就会将term对应的doc作为 结果返回. 2.phrase ...