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 ...
随机推荐
- redhat编译安装cmake
将RHEL的yum软件源更换为CentOS的软件源之后,其中的cmake版本太低,为2.6.4版本,编译较新的软件时会提示cmake版本太低,所以有必要编译安装最新版的cmake. 1. 更换yu ...
- WINDOWS黑客基础(4):查找进程运行的基址
从WINDOWS VISITA开始以后,windows已经开始支持随机基址的关系,也就是说以前我们的进程基址都是从0x40000开始的,如果一个变量在我们第一次运行的时候地址为0x50000,那么以后 ...
- 解读Nodejs多核处理模块cluster
来源: http://blog.fens.me/nodejs-core-cluster/ 从零开始nodejs系列文章,将介绍如何利Javascript做为服务端脚本,通过Nodejs框架web开发. ...
- Datagridview中数字格式列 不显示小数点前面的0
用代码设置DataGridView中某列为数字格式,但当小数为0.*的时候,前面的0却不显示.只显示.*. 看网上有说: 调整本地设置,控制面板-区域和语言选项,在弹出框的区域选项卡中,选择自定义,在 ...
- FlashBuilder(FB/eclipse) 打开多个无效
FB也即Eclipse. 想要打开多个FB,只需要新建多个FB的快捷方式,然后在路径上面加上参数 -data "具体路径" 再打开即可. 如: "C:\Program F ...
- OkHttp 详解
OkHttp使用: http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0106/2275.html OkHttp源码: http:/ ...
- PLSQL_Oracle簇表和簇表管理Index clustered tables(案例)
2012-06-08 Created By BaoXinjian
- cf519D . A and B and Interesting Substrings 数据结构map
题意: 已知26个小写字母有各自的权值(正,负,或0) 现在给出一个字符串,长度<=1e5 问这个字符串有多少个子串满足: 开头的字母和结尾的字母一样 字符串除了开头和结尾的字母外,其余的字母的 ...
- JS的Data类型格式化(转)
// 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(h).分(m).秒(s).季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1-4 个占 ...
- NoSQL与关系型数据库比较
虽然09年出现了比较激进的文章<关系数据库已死>,但是我们心里都清楚,关系数据库其实还活得好好的,你还不能不用关系数据库.但是也说明了一个事实,关系数据库在处理WEB2.0数据的时候,的确 ...