fjnu 1557 Contest Scoreboard

本文介绍了一个比赛排名系统的实现方法,该系统依据参赛队伍解决问题的数量及时间惩罚进行排名。通过输入比赛过程中队伍提交的问题记录,系统能够自动计算最终的排名顺序。

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

Description

Think the contest score boards are wrong? Here's your chance to come up with the right rankings.


Contestants are ranked first by the number of problems solved (the more the better), then by decreasing amounts of penalty time. If two or more contestants are tied in both problems solved and penalty time, they are displayed in order of increasing team numbers.

A problem is considered solved by a contestant if any of the submissions for that problem was judged correct. Penalty time is computed as the number of minutes it took for the first correct submission for a problem to be received plus 20 minutes for each incorrect submission received prior to the correct solution. Unsolved problems incur no time penalties.

Input

Input consists of a snapshot of the judging queue, containing entries from some or all of contestants 1 through 100 solving problems 1 through 9. Each line of input will consist of three numbers and a letter in the format

contestant problem time L

where L can be C, I, R, U or E. These stand for Correct, Incorrect, clarification Request, Unjudged and Erroneous submission. The last three cases do not affect scoring.

Lines of input are in the order in which submissions were received.

Output

Output will consist of a scoreboard sorted as previously described. Each line of output will contain a contestant number, the number of problems solved by the contestant and the time penalty accumulated by the contestant. Since not all of contestants 1-100 are actually participating, display only the contestants that have made a submission.

Sample Input

1 2 10 I
3 1 11 C
1 2 19 R
1 2 21 C
1 1 25 C

Sample Output

1 2 66
3 1 11

 KEY:这题搞死人了他的时间是最后AC的时间,加上被罚的时间;

 

Source:

#include
<iostream>
#include
<algorithm>
using namespace std;

struct node
{
    
int num;
    
int time;
    
int plus;
    
int problem[10];
    
int nproblem;
    
int flag;
}
;

node a[
101];

void count()
{
    
int num,pro,cur;
    
char c;
    
while(cin>>num>>pro>>cur>>c)
    
{
        a[num].flag
=1;        
        
if(c=='C'&&a[num].problem[pro]==0)
        
{
            a[num].time
+=cur;
            a[num].problem[pro]
=1;
            a[num].nproblem
++;
        }

        
if(c=='I')
        
{
            
if(a[num].problem[pro]!=1) a[num].plus++;
        }

    }

    
for(int i=1;i<=100;i++)
    
{
        
if(a[i].nproblem>0) a[i].time+=a[i].plus*20;
    }

}


bool compare(node x,node y)
{
    
if(x.nproblem>y.nproblem) return 1;
    
if(x.nproblem<y.nproblem) return 0;
    
if(x.nproblem==y.nproblem)
    
{
        
if(x.time<y.time) return 1;
        
if(x.time>y.time) return 0;
        
if(x.time==y.time)
        
{
            
if(x.num<y.num) return 1;
            
else return 0;
        }

    }

    
return 1;
}


void output()
{
    
for(int i=1;i<=100;i++)
        
if(a[i].flag)
            cout
<<a[i].num<<" "<<a[i].nproblem<<" "<<a[i].time<<endl;
}


int main()
{
//    freopen("fjnu_1557.txt","r",stdin);
    for(int i=1;i<=100;i++)
        a[i].num
=i;
    count();
    sort(a
+1,a+101,compare);
    output();
    
return 0;
}






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值