hdu 6023 Automatic Judge【ACM规则罚时判定】

xiaoxiao2021-02-28  76

Automatic Judge

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3035    Accepted Submission(s): 1127 Problem 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  

这题主要就是考察对竞赛规则的熟悉,主要是计算罚时(好吧其实我在做这题之前也不知道罚时到底是怎么算的= =。。。)。

简单可以把题目分为AC和未AC两类,如果题目AC了,不管之后AC还是WA都不会产生新的罚时。

每道题都有对应的罚时,计算规则是:

如果这题没有AC,每WA一次该题罚时+20;

如果这题AC了,该题罚时要加上第一次AC的时间,之后不论是否AC都不会再加罚时。

注意,罚时是每个题目都有的,不是总体的,计算最后总的罚时的时候,是这题如果AC了,才会把该题的罚时加入总罚时,如果有个题目一直WA,那么这道题的罚时不会被计入总罚时里。

import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int num = sc.nextInt(); while(num-- > 0) { int n = sc.nextInt(); int m = sc.nextInt(); LinkedList<Integer> ac = new LinkedList<>(); int[] penalty = new int[100000]; int result = 0; while(m-->0) { int id = sc.nextInt()00; String time = sc.next(); String judge = sc.next(); if(ac.contains(id)) { continue; } if(!judge.equals("AC")) { penalty[id] += 20; } if(judge.equals("AC")) { ac.add(id); String[] s = time.split(":"); int hour = Integer.parseInt(s[0]); int minute = Integer.parseInt(s[1]); penalty[id] += hour*60+minute; } } for(int i = 1;i <= n;i++) { if(ac.contains(i)) result += penalty[i]; } System.out.println(ac.size()+" "+result); } } }
转载请注明原文地址: https://www.6miu.com/read-2300193.html

最新回复(0)