2018_2_7_ACM Rank Table_sort_stl
2018-02-07 16:58
447 查看
ACM Rank Table
Description
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:
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
Sample Output
Source
Northeastern Europe 2004, Far-Eastern Subregion
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 5285 | Accepted: 1379 |
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:
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 1
Sample Output
2 1 3
Source
Northeastern Europe 2004, Far-Eastern Subregion
#include<iostream> #include<cstdio> #include<vector> #include<algorithm> using namespace std; const int maxn=1000+10; int n,m; struct judgement{ int c,t,p,r; void input(){ cin>>c>>p>>t>>r; c--; } }; struc e39e t team{ int id,ac,t; int p[25]; bool sol[25]; }; judgement a[maxn]; team t[maxn]; bool cmp_t(judgement &a,judgement &b){ return a.t<b.t; } bool cmp(team &a,team &b){ if(a.ac!=b.ac)return a.ac>b.ac;else if(a.t!=b.t)return a.t<b.t;else return a.id<b.id; } int main(){ scanf("%d%d",&n,&m); for(int i=0;i<m;i++) a[i].input(); for(int i=0;i<n;i++) t[i].id=i; sort(a,a+m,cmp_t); for(int i=0;i<m;i++){ int x=a[i].c,y=a[i].p; if(t[x].sol[y])continue; if(a[i].r){ t[x].t+=1200*t[x].p[y]+a[i].t; t[x].sol[y]=true; t[x].ac++; }else t[x].p[y]++; } sort(t,t+n,cmp); int i=0; for(;i<n-1;i++) printf("%d ",t[i].id+1); printf("%d\n",t[i].id+1); }
相关文章推荐
- (STL自带的排序功能7.1.3)POJ 2379 ACM Rank Table(结构体的排序、初始化)
- 1921: 2018蓝桥杯培训-STL应用专题-day 1 sort作业题1
- POj 2379 ACM Rank Table
- ACM Rank Table POJ - 2379
- POJ 2379 ACM Rank Table(水~)
- 1922: 2018蓝桥杯培训-STL应用专题-day 1 sort作业题2
- 2018_2_7_Who's in the Middle_sort_stl
- 1923: 2018蓝桥杯培训-STL应用专题-day 1 sort作业题3
- POJ-2379 ACM Rank Table 模拟题
- POJ - 2379 - ACM Rank Table
- POJ 2379 ACM Rank Table(排序)
- poj 2379 ACM Rank Table
- poj 2379 ACM Rank Table
- POJ 2379 ACM Rank Table (排序)
- 网易云课堂:2018蓝桥杯培训-STL应用专题 sort作业题2/3
- ACM Rank Table
- ACM Rank Table(poj 2397)
- 2018蓝桥杯培训-STL应用专题-day 1 sort作业题1
- 2017-2018 ACM-ICPCNEERC : Preparing for Merge Sort
- 2018蓝桥杯培训-STL应用专题-day 1 sort作业题2