POJ - 2379 ACM Rank Table
作者:互联网
ACM contests, like the one you are participating in, are hosted by the special software. That software, among other functions, preforms a job of accepting and evaluating teams' solutions (runs), and displaying results in a rank table. The scoring rules are as follows:
Your task is, given the list of N runs with submission time and result of each run, compute the rank table for C teams.
Input Input contains integer numbers C N, followed by N quartets of integes ci pi ti ri, where ci -- team number, pi -- problem number, ti -- submission time in seconds, ri -- 1, if the run was accepted, 0 otherwise.
1 ≤ C, N ≤ 1000, 1 ≤ ci ≤ C, 1 ≤ pi ≤ 20, 1 ≤ ti ≤ 36000. Output Output must contain C integers -- team numbers sorted by rank. Sample Input
- Each run is either accepted or rejected.
- The problem is considered solved by the team, if one of the runs submitted for it is accepted.
- The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submission of the first accepted run for this problem (in minutes) plus 20 minutes for every other run for this problem before the accepted one. For an unsolved problem consumed time is not computed.
- The total time is the sum of the time consumed for each problem solved.
- Teams are ranked according to the number of solved problems. Teams that solve the same number of problems are ranked by the least total time.
- While the time shown is in minutes, the actual time is measured to the precision of 1 second, and the the seconds are taken into account when ranking teams.
- Teams with equal rank according to the above rules must be sorted by increasing team number.
Your task is, given the list of N runs with submission time and result of each run, compute the rank table for C teams.
Input Input contains integer numbers C N, followed by N quartets of integes ci pi ti ri, where ci -- team number, pi -- problem number, ti -- submission time in seconds, ri -- 1, if the run was accepted, 0 otherwise.
1 ≤ C, N ≤ 1000, 1 ≤ ci ≤ C, 1 ≤ pi ≤ 20, 1 ≤ ti ≤ 36000. Output Output must contain C integers -- team numbers sorted by rank. Sample Input
3 3 1 2 3000 0 1 2 3100 1 2 1 4200 1Sample Output
2 1 3
一道简单的排序题,利用的就是acm的竞赛排名规则。大意是队伍参见比赛,然后让我们计算排名,第一关键词是过题数,过题数越多的队伍排名越高,排名相同的队伍看第二关键词时间,时间越短的队伍排名越高。
每道题目提交失败还会罚时,但是要注意的是若不通过题目,是不计算罚时的。
以一个菜鸟的眼光来看,这道题可以用来练习排序,sort,练习函数sort第三个参数的设置及使用。还涉及到结构体或者数组的简单c语言知识,同时也可以使用其他排序方法,但是代码会稍微负责繁琐。
标签:run,number,rank,POJ,2379,time,Table,problem,accepted 来源: https://www.cnblogs.com/She-Chuan/p/10453011.html