我可不是为了被全人类喜欢才活着的,只要对于某一个人来说我|

王陸

园龄:6年11个月粉丝:2052关注:178

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. 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. 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. RuntimeError(RE) : Your program failed during the execution and you will receive the hints for the reasons. 

5. TimeLimitExceeded(TLE) : Your program tried to run during too much time. 

6. MemoryLimitExceeded(MLE): Your program tried to use more memory than the judge default settings. 

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

8. CompilationError(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(1T20), denoting the number of test cases. 
In each test case, there are two integers n(1n13) and 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
In the following m lines, each line contains an integer x(1001x1000+n) and two strings t(00:00t05:00) and s, denoting the team submits problem x at time t, and the result is s. t is in the format of HH:MM, while 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 in the input is in ascending order and every t is unique. 
 

Output

For each test case, print a single line containing two integers A and 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
 
 
 
题目意思:基本就是ACM比赛的判题机制吧,但是有点不一样的是一道题只有最后AC了,才会增加罚时,没有AC的题不增加罚时
 
上代码:
 
 
复制代码
 1 #include<stdio.h>
 2 #include<algorithm>
 3 #include<string.h>
 4 using namespace std;
 5 struct messages
 6 {
 7     int id;//题号
 8     int h;//
 9     int m;//
10     char s[4];//状态
11 } a[100010];
12 int ac[100010];//用来标记是否ac过,ac了代表1,不ac代表0
13 int time[100010];
14 int main()
15 {
16     int t,n,m,i,sum,count;
17     scanf("%d",&t);
18     while(t--)
19     {
20         sum=0;
21         count=0;
22         memset(time,0,sizeof(time));
23         memset(ac,0,sizeof(ac));
24         scanf("%d%d",&n,&m);
25         for(i=0; i<m; i++)
26         {
27             scanf("%d",&a[i].id);
28             scanf("%d:%d",&a[i].h,&a[i].m);
29             scanf(" %s",a[i].s);
30             if(ac[a[i].id]==1)//用来过滤掉那些已经ac的题目
31             {
32                 continue;
33             }
34             if(a[i].s[0]=='A')
35             {
36                 time[a[i].id]+=a[i].h*60+a[i].m;
37                 ac[a[i].id]=1;
38             }
39             else
40             {
41                 time[a[i].id]+=20;
42             }
43             getchar();
44         }
45         for(i=1001; i<=1000+n; i++)//采用了类似哈希的方法
46         {
47             if(ac[i])
48             {
49                 sum+=time[i];
50                 count++;
51             }
52         }
53         printf("%d %d\n",count,sum);
54     }
55     return 0;
56 }
复制代码

 

本文作者:王陸

本文链接:https://www.cnblogs.com/wkfvawl/p/9026097.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   王陸  阅读(206)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起