The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.

Input Specification:

Each input file contains one test case. For each case, the first line contains 3 positive integers, N (≤), the total number of users, K (≤), the total number of problems, and M (≤), the total number of submissions. It is then assumed that the user id's are 5-digit numbers from 00001 to N, and the problem id's are from 1 to K. The next line contains K positive integers p[i] (i=1, ..., K), where p[i]corresponds to the full mark of the i-th problem. Then M lines follow, each gives the information of a submission in the following format:

user_id problem_id partial_score_obtained

where partial_score_obtained is either − if the submission cannot even pass the compiler, or is an integer in the range [0, p[problem_id]]. All the numbers in a line are separated by a space.

Output Specification:

For each test case, you are supposed to output the ranklist in the following format:

rank user_id total_score s[1] ... s[K]

where rank is calculated according to the total_score, and all the users with the same total_scoreobtain the same rank; and s[i] is the partial score obtained for the i-th problem. If a user has never submitted a solution for a problem, then "-" must be printed at the corresponding position. If a user has submitted several solutions to solve one problem, then the highest score will be counted.

The ranklist must be printed in non-decreasing order of the ranks. For those who have the same rank, users must be sorted in nonincreasing order according to the number of perfectly solved problems. And if there is still a tie, then they must be printed in increasing order of their id's. For those who has never submitted any solution that can pass the compiler, or has never submitted any solution, they must NOT be shown on the ranklist. It is guaranteed that at least one user can be shown on the ranklist.

Sample Input:

7 4 20
20 25 25 30
00002 2 12
00007 4 17
00005 1 19
00007 2 25
00005 1 20
00002 2 2
00005 1 15
00001 1 18
00004 3 25
00002 2 25
00005 3 22
00006 4 -1
00001 2 18
00002 1 20
00004 1 15
00002 4 18
00001 3 4
00001 4 2
00005 2 -1
00004 2 0

Sample Output:

1 00002 63 20 25 - 18
2 00005 42 20 0 22 -
2 00007 42 - 25 - 17
2 00001 42 18 18 4 2
5 00004 40 15 0 25 -
 #include<bits/stdc++.h>
using namespace std;
struct Result{
int id=,score[]={-,-,-,-,-,-},rank=,num=,totalScore=;//id、每题分数、排名、满分的题目个数、总分
bool flag=false;//标志是否有通过编译的代码,即是否要进行输出
};
bool cmp(const Result&r1,const Result&r2){//比较函数
if(r1.totalScore!=r2.totalScore)
return r1.totalScore>r2.totalScore;
else if(r1.num!=r2.num)
return r1.num>r2.num;
else
return r1.id<r2.id;
}
Result m[(int)(1e5+)];//Result的数组
int main(){
int N,K,M;
scanf("%d%d%d",&N,&K,&M);
int P[K+];//存储每题的满分
for(int i=;i<=K;++i)
scanf("%d",&P[i]);
while(M--){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
m[a].id=a;
if(c>-)//有通过编译的代码
m[a].flag=true;//置flag为true
else if(c==-)//不能通过编译
c=;//置得分为0
m[a].score[b]=max(m[a].score[b],c);//更新该题得分为最高分
}
for(int i=;i<=N;++i)//遍历数组result
if(m[i].flag)//需要进行输出
for(int j=;j<=K;++j){//遍历考试的所有题目
if(m[i].score[j]==P[j])//有拿满分的题目
++m[i].num;//递增满分题目数
m[i].totalScore+=m[i].score[j]<?:m[i].score[j];//更新总分
}
sort(m+,m+N+,cmp);//排序
for(int i=;i<=N;++i)//得出排名
m[i].rank=m[i].totalScore!=m[i-].totalScore?i:m[i-].rank;
for(int i=;i<=N;++i)//遍历数组result
if(m[i].flag){//输出
printf("%d %05d %d",m[i].rank,m[i].id,m[i].totalScore);
for(int j=;j<=K;++j)
if(m[i].score[j]<)//该题没有通过编译或没有提交
printf(" -");//输出-
else
printf(" %d",m[i].score[j]);
printf("\n");
}
return ;
}

PAT甲级——A1075 PAT Judge的更多相关文章

  1. PAT 甲级 1075 PAT Judge (25分)(较简单,注意细节)

    1075 PAT Judge (25分)   The ranklist of PAT is generated from the status list, which shows the scores ...

  2. PAT甲级1075 PAT Judge

    题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805393241260032 题意: 有m次OJ提交记录,总共有k道 ...

  3. PAT 甲级 1141 PAT Ranking of Institutions

    https://pintia.cn/problem-sets/994805342720868352/problems/994805344222429184 After each PAT, the PA ...

  4. PAT 甲级 1025 PAT Ranking

    1025. PAT Ranking (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Programmi ...

  5. PAT 甲级 1025.PAT Ranking C++/Java

      Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Z ...

  6. PAT 甲级1025 PAT Ranking (25 分)(结构体排序,第一次超时了,一次sort即可小技巧优化)

    题意: 给定一次PAT测试的成绩,要求输出考生的编号,总排名,考场编号以及考场排名. 分析: 题意很简单嘛,一开始上来就,一组组输入,一组组排序并记录组内排名,然后再来个总排序并算总排名,结果发现最后 ...

  7. PAT甲级——A1025 PAT Ranking

    Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhe ...

  8. PAT甲级——1025 PAT Ranking

    1025 PAT Ranking Programming Ability Test (PAT) is organized by the College of Computer Science and ...

  9. A1075 PAT Judge (25)(25 分)

    A1075 PAT Judge (25)(25 分) The ranklist of PAT is generated from the status list, which shows the sc ...

随机推荐

  1. 【Wikioi】P1401 逆序统计 代码

    题目链接:http://wikioi.com/solution/list/1401/ 题解链接:http://user.qzone.qq.com/619943612/blog/1377265690 代 ...

  2. kafka 入门

    李克华 云计算高级群: 292870151 195907286 交流:Hadoop.NoSQL.分布式.lucene.solr.nutch  kafka入门:简介.使用场景.设计原理.主要配置及集群搭 ...

  3. 几个实用的js函数

    在阅读JavaScript DOM编程艺术这本书时看到了一些比较实用的代码. //加载多个window.onload事件 function addLoadEvent(func) { var oldon ...

  4. JS对象 JavaScript 中的所有事物都是对象,如:字符串、数值、数组、函数等,每个对象带有属性和方法。

    什么是对象 JavaScript 中的所有事物都是对象,如:字符串.数值.数组.函数等,每个对象带有属性和方法. 对象的属性:反映该对象某些特定的性质的,如:字符串的长度.图像的长宽等: 对象的方法: ...

  5. CSIC_716_20191028【爬小破站】

    1.爬取小破站的弹幕 2.展示爬取内容 打开网页,用教的方法找到cid 和header import requests from bs4 import BeautufulSoup import pan ...

  6. Liunx下安装Oracle11g时Oracle Grid安装包下载向导

    下载Oracel 11g  Grid的安装包 Oracle官网 https://www.oracle.com 快捷访问路径:https://www.oracle.com/technetwork/dat ...

  7. mysql 主从笔记

    主库配置 一.修改主库配置文件 开启binlog,并设置server-id,每次修改配置文件后都要重启mysql服务才会生效 server-id = log-bin = mysql-bin binlo ...

  8. 阿里云SaaS加速器“宜搭”发布宜搭Plus提升6倍研发效率

    9月26日,在杭州云栖大会上,阿里云SaaS加速器的“底座”——“宜搭”正式发布“宜搭Plus”低代码开发平台.开发复杂企业业务系统所需要的领域数据模型.逻辑&服务编排.专业UI页面设计等,都 ...

  9. tomcat下文件路径

    第一种:复制要访问的文件a.txt至tomcat安装路径下的webapps/ROOT文件夹下: 访问路径为:localhost:8080/a.txt 或者在webapps文件夹下新建一个文件夹(tes ...

  10. 训练计划Day1

    Day1:二分答案,三分查找,快速幂,欧拉筛素数 | 题目:火星人,Bridge,GCD,Prime Path 二分答案 [JSOI 2008] 火星人 对于第一个操作用\(hash + 二分\)来求 ...