POJ2379---ACM Rank Table

本文深入解析ACM竞赛的计分规则,包括接受与拒绝的评判标准、解决题目所需时间和罚时的计算方式,以及团队排名的决定因素。通过实例演示如何根据提交的时间和结果来生成排名表。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Language:Default

ACM Rank Table

Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 5785 Accepted: 1475

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: 
  1. Each run is either accepted or rejected. 
  2. The problem is considered solved by the team, if one of the runs submitted for it is accepted. 
  3. 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. 
  4. The total time is the sum of the time consumed for each problem solved. 
  5. 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. 
  6. 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. 
  7. 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

 

个人吐槽:很坑的一道题,有没有!

/*
这道题需要注意的是:
  a.一次都没有提交过的队伍
  b.已经WA了的
  c.罚时一个是分一个是秒
  d.不是按时间顺序给的
*/
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int N,C;
struct node1
{
    int c1,flag[1005],t[1005],numbers,times;
}a[10005];
struct node2
{
     int ci,ti,pi,ri;
}b[10005];
bool cmp1(node2 x,node2 y)
{
    return x.ti<y.ti; //先按时间顺序排列
}
bool cmp2(node1 x,node1 y)//三层排序
{
if(x.numbers!=y.numbers)//第一层:通过题数多的在前
    return x.numbers>y.numbers;
else if(x.times!=y.times)//第二层:通过题数相同:用时少的在前
    return x.times<y.times;
else//第三层:题数、时间相同时,队列编号小的在前
    return x.c1<y.c1;
}
int main()
{
   scanf("%d%d",&C,&N);
       for(int i=1;i<=C;i++)//对结构体node1数据初始化
       {
           memset(a[i].flag,0,sizeof(a[i].flag));
           memset(a[i].t,0,sizeof(a[i].t));
           a[i].numbers=a[i].times=0;
           a[i].c1=i;
       }
       for(int i=1;i<=N;i++)
        scanf("%d%d%d%d",&b[i].ci,&b[i].pi,&b[i].ti,&b[i].ri);
       sort(b+1,b+N+1,cmp1);//时间排序
       for(int i=1;i<=N;i++)
       {
          int c2=b[i].ci;
          int p2=b[i].pi;
          int t2=b[i].ti;
          int r2=b[i].ri;
          if(a[c2].flag[p2])continue;//已经AC过
          if(r2)//不是一次AC
          {
              a[c2].flag[p2]=1;//标记
              a[c2].numbers++;//通过题数+1
              a[c2].times+=t2+a[c2].t[p2];//罚时加第一次AC提交的时间
          }
          else//WA
            a[c2].t[p2]+=1200;//加二十分钟罚时
       }
         sort(a+1,a+C+1,cmp2);//三层排序
        for(int i=1;i<=C;i++)printf("%d%c",a[i].c1,i==C?'\n':' ');
        return 0;
}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值