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 ...
随机推荐
- ansible publishing service
# ansible 初始化服务机 - hosts: newserver vars: - basedir: opt tasks: - name: 安装常用依赖环境 yum: name={{ item } ...
- PHP第二阶段学习 一、php的基本语法
php的基本语法 输出语句:a. echo输出:可以输出多个字符串,逗号隔开 b. print输出:只能输出一个字符串,返回true或false c. print_r():可以把字符串和数字简单 ...
- mongo3.4 配置文件 注意事项
给mongo配置文件坑了好久,今天终于解决了.写个博客,庆祝一下. mongo3.4 版本,我是用YAML格式的配置文件. 一开始,配置之后,启动服务的时候,老是提示:“unrecognized op ...
- java与javascript之间json格式数据互转
javascript中对象与字符串的互转 对象转为字符串:通过JSON.encode方法,这个是json.js里面的方法,引入到当前文件就可以了. 字符串转换为对象:①使用JSON.decode方法, ...
- String s="a"+"b"+"c"+"d";创建了几个对象?
对于如下代码: package reviewTest; /** * @ClassName: StringTest * @Description: 测试String的字符串相加优化 * @author ...
- 3.filter原理(bitset机制与caching机制)
主要知识点: 一次filter执行顺序 filter和query的特点 一.一次filter执行顺序 1.在倒排索引中查找搜索串,获取document list 以一下date数据来举 ...
- Codeforces 918D/917B - MADMAX
传送门:http://codeforces.com/contest/918/problem/D 本题是一个组合游戏问题——DAG上的动态规划问题. 有一张有向无环图(DAG).有两个玩家在这张图上进行 ...
- springcloud(六):给Eureka Server服务器端添加用户认证
1. 还未完成 ,客户端有点问题,后期完善 2.
- MySQL之SQL优化详解(一)
目录 慢查询日志 1. 慢查询日志开启 2. 慢查询日志设置与查看 3.日志分析工具mysqldumpslow 序言: 在我面试很多人的过程中,很多人谈到SQL优化都头头是道,建索引,explai ...
- 【Mail.Ru Cup 2018 Round 2 B】 Alice and Hairdresser
[链接] 我是链接,点我呀:) [题意] [题解] 因为只会增加. 所以. 一开始暴力算出来初始答案 每次改变一个点的话. 就只需要看看和他相邻的数字的值就好. 看看他们是不是大于l 分情况增加.减少 ...