Test Cases

SCB-PA Inter School and C...
Limits 1s, 512 MB

Byang's friend is building a sport programming platform and needs your help with one of the modules.

He wants you to write a program that will take a list of test case details for a submission and determine a verdict for the submission. For each test case you will be given the number of differences found in the output, the CPU/Time usage (in seconds) and the memory usage (in megabytes). Based on these details, you will have to award one of the following verdicts for the submission:

  • CLE: CPU Limit Exceeded is awarded when any of the test cases takes more time than the CPU limit.
  • MLE: Memory Limit Exceeded is awarded when any of the test cases takes more memory than the memory limit.
  • WA: Wrong Answer is awarded when any of the test cases produce a non-zero difference value.
  • AC: Accepted is awarded when all of the test cases pass without any issue.

If multiple verdicts are applicable for a test case, then prioritize the one that appears earlier in the list above.

When there are differing verdicts among two or more test cases, the overall verdict is awarded based on the verdict of the earlier non-AC test case.

Here are two examples. For both, assume the CPU limit to be 2s and memory limit to be 32 MB.

Example 1:

DifferencesCPUMemoryTest Case Verdict

Overall verdict: CLE

Note that for the third case, CLE was awarded even though MLE was applicable. This is because CLE has a higher priority according to the list given above. And the overall verdict was CLE (and not WA) because the third case was the first/earliest non-AC test case.

Example 2:

DifferencesCPUMemoryTest Case Verdict

Overall verdict: AC


The input will start with three integers: N (0 < N < 10), CPUL (0 < CPUL < 16), MEML (0 < MEML < 512). Here N is the number of test cases, CPUL is the CPU limit, and MEML is the memory limit.

Each of the following N lines will contain three integers: Di, CPUi and MEMi. Here Di is the differences in the ith test case, CPUi is the CPU usage of the ith test case, and MEMi is the memory usage of the ith test case.


Print the correct overall verdict (AC, WA, MLE or CLE) based on the details of the given test cases.


4 2 32
0 1 18
0 1 12
0 3 36
5 1 10
4 2 32
0 1 18
0 1 12
0 1 30
0 2 32


Login to submit.



83% Solution Ratio
YouKnowWhoEarliest, Mar '19
YouKnowWhoFastest, 0.0s
ReduancsLightest, 0 B
Nusab19Shortest, 146B
Toph uses cookies. By continuing you agree to our Cookie Policy.