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) Accepted(AC): Yes, your program is correct. You did a good job!
2. PresentationError(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. WrongAnswer(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. RuntimeError(RE) RuntimeError(RE) : Your program failed during the execution and you will receive the hints for the reasons.
5. TimeLimitExceeded(TLE) TimeLimitExceeded(TLE) : Your program tried to run during too much time.
6. MemoryLimitExceeded(MLE) MemoryLimitExceeded(MLE): Your program tried to use more memory than the judge default settings.
7. OutputLimitExceeded(OLE) OutputLimitExceeded(OLE): Your program tried to write too much information. This usually occurs if it goes into a infinite loop.
8. CompilationError(CE) 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.
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) Accepted(AC): Yes, your program is correct. You did a good job!
2. PresentationError(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. WrongAnswer(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. RuntimeError(RE) RuntimeError(RE) : Your program failed during the execution and you will receive the hints for the reasons.
5. TimeLimitExceeded(TLE) TimeLimitExceeded(TLE) : Your program tried to run during too much time.
6. MemoryLimitExceeded(MLE) MemoryLimitExceeded(MLE): Your program tried to use more memory than the judge default settings.
7. OutputLimitExceeded(OLE) OutputLimitExceeded(OLE): Your program tried to write too much information. This usually occurs if it goes into a infinite loop.
8. CompilationError(CE) 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.
In each test case, there are two integers n(1≤n≤13) n(1≤n≤13) and m(1≤m≤100) m(1≤m≤100) 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.
In the following m m lines, each line contains an integer x(1001≤x≤1000+n) x(1001≤x≤1000+n) and two strings t(00:00≤t≤05:00) t(00:00≤t≤05:00) and s s, denoting the team submits problem x x at time t t, and the result is s s. t t is in the format of HH:MM, while 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 in the input is in ascending order and every t t is unique.
1 3 5 1002 00:02 AC 1003 00:05 WA 1003 00:06 WA 1003 00:07 AC 1002 04:59 AC
2 49
题目大意:有n道题,题目分为AC和非AC,如果一道题目到结束都没有AC,那么这道题将不算时间,如果到最后AC了,那么时间就是罚时时间加这道题的用时时间。已近AC的题要做个标记。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstring>
using namespace std;
static const int N = 10005;
int T,h,mi,n,m,time[N];
bool a[N];
int main()
{
scanf("%d" , &T);
while(T--)
{
memset(a,0,sizeof(a));
memset(time,0,sizeof(time));
scanf("%d%d" , &n , &m);
while(m--)
{
int x;
char c[15] = {'\0'};
scanf("%d%d:%d%s" ,&x, &h ,&mi,c);
if(a[x])
continue;
if(c[0] == 'A')
{
time[x] += (h * 60 + mi);
a[x] = 1;
}
else
time[x] += 20;
}
int ac= 0 , ans= 0;
for(int i = 1001 ; i <= 1000 + n ; i++)
{
if(a[i])
{
ans += time[i];
ac++;
}
}
printf("%d %d\n" , ac, ans);
}
return 0;
}