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 ...
随机推荐
- 6.11---上传图片遇到的bug,字节流输入流输出流----图解----图片必须是post
!!!这里要注意不能是目录必须是指定的文件名+目录,不然就存照片到指定的目录不成功 ----------------------------------------完整controller-servi ...
- Jquery 多行拖拽图片排序 jq优化
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- node的api
一. 1.url: 绝对URI http://user:pass@www.example.com:80/dir/index.html?uid=1#ch1 协议 登录信息 服务器地址 端口 文件路径 查 ...
- Android 基础知识图谱
四大组件 Activity Service BroadcastReceiver ContentProvider Application 常用组件 Fragment RecyclerView WebVi ...
- ProE常用曲线方程:Python Matplotlib 版本代码(蝴蝶曲线)
花纹的生成可以使用贴图的方式,同样也可以使用方程,本文列出了几种常用曲线的方程式,以取代贴图方式完成特定花纹的生成. 注意极坐标的使用................. 前面部分基础资料,参考:Pyt ...
- 文艺平衡树(区间翻转)(Splay模板)
这篇blog写的吼啊 #include<cstdio> #include<iostream> #include<cstring> using namespace s ...
- pythonGUI编程——Qt库(1)
1.简单示例实现一个小窗口. PyQt5是一种高级的语言,下面只有几行代码就能显示一个小窗口.底层已经实现了窗口的基本功能. #!/usr/bin/python#coding:utf-8# ...
- Vue(八)全局变量和全局方法
一.在main.js同级目录建立一个common.js文件 // 全局变量 const globalObj = {}; // 定义公共变量 globalObj.name = '小明'; // 定义公共 ...
- Python 模块的导入 day5
一.模块 1.标准模块 python自带的 2.第三方模块 需要自己安装的模块 3.自己写的python文件 一个python文件,就是一个模块 (1)导入模块的实质 就是把你导入的模块运行了一遍 ( ...
- Lua操作符的优先级
lua 操作符的优先级 lua操作符的优先级 如表所示(从高到低) 在二元操作符中,除了指数操作符 “^” 和连接操作符 “..” 是 ”右结合” 的,是所有其他操作符都是 “左结合” 的.因此如 ...