The Ninth Hunan Collegiate Programming Contest (2013) Problem L
Problem L
Last Blood
In many programming contests, special prizes are given to teams who solved a particular problem first. We call the first accepted solution "First Blood".
It's an interesting idea to set prizes for "Last Blood". Then people won't submit their solutions until the last minute. But this is dangerous: if the solution got "Wrong Answer" or even "Time limit exceeded", it may be too late to correct the solution.
You may argue that once a submission got "Accepted", the team can send it again, but in this problem, we only consider the earliest accepted solution of a team for each problem, so re-sending an accepted solution does NOT help!
Given all the submissions in a contest, your task is to find out the "Last Blood" prizes for each problem.
Input
There is only one test case. The first line contains three integer n, t, m (5<=n<=12, 10<=t<=100, 1<=m<=1000), the number of problems, teams and submissions. Each of the following m lines describes one submission: time (0<=time<=300), teamID(1~t), problem (A~L) and verdict("Yes" or "No"). Submissions are sorted in time order. That means for two submissions of the same "time" field, the submission that comes later in the input is received later in the contest (maybe only a few seconds later). No two submissions are received in exactly the same time.
Output
For each problem, print the last blood's time and teamID.
Sample Input
5 10 18
0 2 B No
11 2 B Yes
20 3 A Yes
35 8 E No
40 8 E No
45 7 E No
50 10 A Yes
100 4 A No
120 6 B Yes
160 2 E Yes
180 2 A Yes
210 3 B Yes
240 10 B No
250 10 B Yes
270 2 B Yes
295 8 E Yes
295 7 E Yes
299 10 D Yes
Output for the Sample Input
A 180 2
B 250 10
C - -
D 299 10
E 295 7
The Ninth Hunan Collegiate Programming Contest (2013) Problemsetter: Rujia Liu Special Thanks: Md. Mahbubul Hasan
记在这个地方主要是怕以后忘记接口,也方便大家交流,可能方法很傻吧。
#include <iostream>
#include <stdio.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <stack>
#include <math.h>
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
using namespace std ;
typedef long long LL ; struct Node{
int team ;
int time ;
int id ;
Node(){} ;
Node(int i ,int te,int ti):id(i),team(te),time(ti){} ;
friend bool operator <(const Node A ,const Node B){
if(A.time==B.time)
return A.id>B.team ;
else
return A.time>B.time ;
}
};
set<int>problem_man[] ;
set<Node>problem[] ; int N , M , T ;
int main(){
cin>>N>>M>>T ;
for(int i=;i<N;i++){
problem[i].clear() ;
problem_man[i].clear() ;
}
int time ,team;
string problem_id ,answer ;
for(int t=;t<=T;t++){
cin>>time>>team>>problem_id>>answer ;
int id=problem_id[]-'A' ;
if(answer=="Yes"){
if(problem_man[id].find(team)==problem_man[id].end()){
problem_man[id].insert(team) ;
problem[id].insert(Node(t,team,time)) ;
}
}
}
set<Node>::iterator p ;
for(int i=;i<N;i++){
if(problem[i].size()){
p=problem[i].begin() ;
printf("%c %d %d\n",'A'+i,p->time ,p->team) ;
}
else
printf("%c - -\n",'A'+i ) ;
}
return ;
}
The Ninth Hunan Collegiate Programming Contest (2013) Problem L的更多相关文章
- The Ninth Hunan Collegiate Programming Contest (2013) Problem A
Problem A Almost Palindrome Given a line of text, find the longest almost-palindrome substring. A st ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem F
Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roa ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem H
Problem H High bridge, low bridge Q: There are one high bridge and one low bridge across the river. ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem I
Problem I Interesting Calculator There is an interesting calculator. It has 3 rows of button. Row 1: ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem J
Problem J Joking with Fermat's Last Theorem Fermat's Last Theorem: no three positive integers a, b, ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem G
Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student n ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem C
Problem C Character Recognition? Write a program that recognizes characters. Don't worry, because yo ...
- German Collegiate Programming Contest 2013:E
数值计算: 这种积分的计算方法很好,学习一下! 代码: #include <iostream> #include <cmath> using namespace std; ; ...
- German Collegiate Programming Contest 2013:B
一个离散化的简单题: 我用的是STL来做的离散化: 好久没写离散化了,纪念一下! 代码: #include<cstdio> #include<cstring> #include ...
随机推荐
- HBase(七): HBase体系结构剖析(下)
目录: write Compaction splite read Write: 当客户端发起一个Put请求时,首先根据RowKey寻址,从hbase:meta表中查出该Put数据最终需要去的HRegi ...
- linux下的chmod,chown和chgrp
对于linux的权限掌握以下几个命令就可以非常熟练的操作系统中的各种权限了. 使用权限 : 所有使用者 使用方式 : chmod [-cfvR] [--help] [--version] mode f ...
- 【linux】locate介绍
Locale和everything 类似,有本地的检索库,它会自动更新检索库,但新创建的文件,不能用locale 查到,需要手动更新检索库update db 才能搜索到,在/tmp 目录下的文件不能搜 ...
- 在使用Redis的客户端连接工具ServiceStack.Redis要注意的问题
在使用Redis的客户端连接工具ServiceStack.Redis要注意的问题 Redis是一个非常NB的内存级的数据库,我们可以把很多”热数据“(即读写非常多的数据)放入其中来操作,这样就减少 ...
- golang获取字符串长度需要注意的地方
中文长度,直接贴代码 package main import ( "fmt" "unicode/utf8" ) func main() { aa := &quo ...
- ASP.NET网页验证码常用方法
验证码生产类 using System; using System.Data; using System.Configuration; using System.Web; using System.W ...
- 2014 年10个最佳的PHP图像操作库
2014 年10个最佳的PHP图像操作库 Thomas Boutell 以及众多的开发者创造了以GD图形库闻名的一个图形软件库,用于动态的图形计算. GD提供了对于诸如C, Perl, Pytho ...
- 黄聪:wordpress工作原理
WP初始化的过程:当你输入<yourlink>/wordpress对wordpress进行初始化时,wordpress默认会找根目录下的index.php页面,看一下index.php页面 ...
- CF 500 B. New Year Permutation 并查集
User ainta has a permutation p1, p2, ..., pn. As the New Year is coming, he wants to make his permut ...
- DrawTools(画图工具)原始版本
上一篇文章一个优秀的C#开源绘图软件 DrawTools中详细的介绍了DrawTools的几种演化的较高版本的软件的特色与功能. 这篇文章,将介绍一下这款软件的成名版本, 下载地址DrawTool_O ...