【西南交大峨眉校区INT杯网络赛 --- A. INT比赛排名】模拟
Description
第一届”INT”杯程序设计竞赛网络赛在今天正式开赛了。
比赛开始后,有n位参赛选手提交了m份代码,已知比赛共有k道题,当某一参赛选手通过的题目数越多,他的排名就越靠前,当两人通过的题数相同时,总罚时越少的排名越靠前,若两人总罚时也相同,则姓名字典序较小的排名越靠前。总罚时的计算规则是:当某一参赛选手第一次通过了一道题时,他的总罚时要增加通过这道题距离比赛开始的时间和通过这道题前所尝试的次数乘20,第二次通过相同的题目时不会计算总罚时,未通过题目时也不会计算总罚时。刚开始每位参赛选手的通过题目数和总罚时都为0。请你写一个程序判断选手们提交m份代码后他们的排名。
Input
输入第一行包含3个正整数n,m,k(2<=n<=10,1<=m<=10^{5}10 5 ,1<=k<=26)。
随后m行,每行包含4个数据name(1<=|name|<=10),ID(1<=ID<=k),s(s=”AC”或s=”WA”)和time(0<=time<=300)代表提交代码的选手姓名,提交代码的题目,代码的评测结果(AC代表通过,WA代表未通过)以及提交代码时距离比赛开始的时间。
Output
按排名从高到低输出所有参赛队员的姓名。
Sample Input
2 5 3
int 1 AC 188
double 2 AC 157
double 2 WA 33
double 1 WA 137
double 2 AC 2
Sample Output
double
int
AC代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48#include <iostream> #include <algorithm> #include <map> #include <string> #include <vector> using namespace std; #define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) int n,m,k; int main() { SIS; map<string,map<int,vector<pair<int,string>>>> mp; string name,s; int id,t; cin >> n >> m >> k; for(int i=0;i<m;i++) { cin >> name >> id >> s >> t; mp[name][id].push_back(make_pair(t,s)); } vector<pair<pair<int,int>,string>> v; for(map<string,map<int,vector<pair<int,string>>>>::iterator it=mp.begin();it!=mp.end();it++) { int cnt=0,tt=0; for(map<int,vector<pair<int,string>>>::iterator itt=(*it).second.begin();itt!=(*it).second.end();itt++) { int len=(*itt).second.size(); sort((*itt).second.begin(),(*itt).second.end()); for(int i=0;i<len;i++) { if((*itt).second[i].second[0]=='A') { cnt++; tt+=(*itt).second[i].first+i*20; break; } } } v.push_back(make_pair(make_pair(-cnt,tt),it->first)); } sort(v.begin(),v.end()); int len=v.size(); for(int i=0;i<len;i++) cout << v[i].second << endl; return 0; }
最后
以上就是可爱薯片最近收集整理的关于【西南交大峨眉校区INT杯网络赛 --- A. INT比赛排名】模拟的全部内容,更多相关【西南交大峨眉校区INT杯网络赛内容请搜索靠谱客的其他文章。
发表评论 取消回复