Automatic Judge(Automatic Judge)

Description
Welcome to HDU to take part in the second CCPC girls’ competition!
A new automatic judge system is used for this competition. During the five-hour contest time, you can submit your code to the system, then the judge will reply you. Here is a list of the judge’s replies and their meaning:

  1. $Accepted (AC) $: Yes, your program is correct. You did a good job!

  2. P r e s e n t a t i o n E r r o r ( P E ) Presentation Error (PE) PresentationError(PE) : Your program’s output format is not exactly the same as required by the problem, although the output is correct. This usually means the existence of omitted or extra blank characters (white spaces, tab characters and/or new line characters) between any two non-blank characters, and/or blank lines (a line consisting of only blank characters) between any two non-blank lines. Trailing blank characters at the end of each line and trailing blank lines at the of output are not considered format errors. Check the output for spaces, blank lines, etc. against the problem’s output specification.

  3. W r o n g A n s w e r ( W A ) Wrong Answer (WA) WrongAnswer(WA) : Correct solution not reached for the inputs. The inputs and outputs that we use to test the programs are not public (it is recomendable to get accustomed to a true contest dynamic ?

  4. R u n t i m e E r r o r ( R E ) Runtime Error (RE) RuntimeError(RE) : Your program failed during the execution and you will receive the hints for the reasons.

  5. T i m e L i m i t E x c e e d e d ( T L E ) Time Limit Exceeded (TLE) TimeLimitExceeded(TLE) : Your program tried to run during too much time.

  6. $Memory Limit Exceeded (MLE) $: Your program tried to use more memory than the judge default settings.

  7. $Output Limit Exceeded (OLE) $: Your program tried to write too much information. This usually occurs if it goes into a infinite loop.

  8. $Compilation Error (CE) $: The compiler fails to compile your program. Warning messages are not considered errors. Click on the judge’s reply to see the warning and error messages produced by the compiler.

For each submission, if it is the first time that the judge returns ``AC’’ on this problem, then it means you have passed this problem, and the current time will be added to the penalty of your team. In addition, every time you pass a problem, each unsuccessful try for that problem before is counted as 20 minutes penalty, it should also be added to the penalty of your team.
Now given the number of problems in the contest and the submission records of a team. Please write a program to calculate the number of problems the team passed and their penalty.

Input
The first line of the input contains an integer T ( 1 ≤ T ≤ 20 ) T(1\leq T\leq20) T(1T20), denoting the number of test cases.
In each test case, there are two integers n ( 1 ≤ n ≤ 13 ) n(1\leq n\leq 13) n(1n13) and m ( 1 ≤ m ≤ 100 ) m(1\leq m\leq 100) m(1m100) in the first line, denoting the number of problems and the number of submissions of a team. Problems are labeled by 1001, 1002, …, 1000 + n 1000+n 1000+n.
In the following m m m lines, each line contains an integer x ( 1001 ≤ x ≤ 1000 + n ) x(1001\leq x\leq 1000+n) x(1001x1000+n) and two strings t ( 00 : 00 ≤ t ≤ 05 : 00 ) t(00:00\leq t\leq 05:00) t(00:00t05:00) and s s s, denoting the team submits problem x x x at time t t t, and the result is s s s. t t t is in the format of HH:MM, while s s s is in the set {AC, PE, WA, RE, TLE, MLE, OLE}. The team is so cautious that they never submit a CE code. It is guaranteed that all the t t t in the input is in ascending order and every t t t is unique.

Output
For each test case, print a single line containing two integers A A A and B B B, denoting the number of problems the team passed and the penalty.

Sample Input
1
3 5
1002 00:02 AC
1003 00:05 WA
1003 00:06 WA
1003 00:07 AC
1002 04:59 AC
 
Sample Output
2 49

/*
判断 AC 的数量,和罚时的时间
注意的是:
一道题第一次AC时 总时间要加上AC的时间点
每错一次则会在最后的时间上加上20分钟。问你最终的时间为多少
一道题只有最后AC了,才会增加罚时,没有AC的题不增加罚时
样例: AC的是 1002,1003
罚时:2+2*20+7=49
*/
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
    int t,n,m,i,a,sum=0,time=0;
    char s[10],c[10];
    int flag[1001],w[1001];
    scanf("%d",&t);
    while(t--)
    {
        sum=0,time=0;
        memset(s,0,sizeof(s));
        memset(c,0,sizeof(c));
        memset(flag,0,sizeof(flag));
        //标记该题已经提交过了,不再加 提交该题的时间
        memset(w,0,sizeof(w));//代表某道题 AC 之前 总共错了几次
        scanf("%d %d",&n,&m);
        while(m--)
        {
            scanf("%d",&a);
            cin>>s;
            cin>>c;
            a-=1000;//题目数的最后一位数用来判断 提交的是哪一题
            if(flag[a])
                continue;
            if(c[0]=='A')
            {
                flag[a]=1;//该题 已经提交过了
                sum++;
                time+=(s[4]-48)*1+(s[3]-48)*10+(s[1]-48)*60;
	        // s[4]- 秒,s[3]- 分 ,s[1]-时
                time+=w[a]*20;
            }
            else
                w[a]++;//该题 提交之前 错误的数量
        }
        printf("%d %d\n",sum,time);
    }

}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值