 # Test Cases

This is a companion discussion topic for the original entry at https://toph.co/p/test-cases
1 Like
``````i=0
OP=[]
N, CPU, MEM = map(int, input().split())
while i!=N:
Di, CPUi, MEMi = map(int, input().split())
if Di!=0:
OP+=["WA"]
if MEMi>MEM:
OP+=["MLE"]
if CPUi>CPU:
OP+=["CLE"]
i+=1

if "CLE" in OP:
print("CLE")
elif "MLE" in OP:
print("MLE")
elif "WA" in OP:
print("WA")
else:
print("AC")
``````

I used this code. It gets wrong answer in the 4th case. Can someone give me a hint what my fault could be here?

@Rafeed Hint: What if there is a case where the verdict should be WA because one of the earlier test cases have a non-zero difference value?

@hjr265 Thanks. I didn’t even got the question properly I see.

Can you give me the result of this case:

``````4 5 6
0 1 3
1 0 9
0 0 0
4 2 9
``````

When you need to generate the output of a test case, you can always use uDebug (assuming that it has an entry for the problem you are trying to solve):

At the top of the problem statement, click on the uDebug button and then you can use the uDebug tool to generate the output for this input.

Wrong answer on testcase 5. Any hint ???

``````#include <bits/stdc++.h>
using namespace std;

int main(){
int c,cpu, mem;
cin >> c >> cpu >> mem;
int ac;

int d[c], cp[c], m[c];
for(int i = 0; i < c; i++)
cin >> d[i] >> cp[i] >> m[i];

for(ac = 0; ac < c; ac++){
if(d[ac] > 0){
cout << "WR" << endl;
break;
}
else if(cp[ac] > cpu){
cout << "CLE" << endl;
break;
}
else if(m[ac] > mem){
cout << "MLE" << endl;
break;
}

}
if(ac == c)
cout << "AC" << endl;
return 0;
}
``````

@hjr265
What’t wrong with my code?

``````#include<stdio.h>
int main(){
int t,an,cp,me,cpt,met,k=0,j;
scanf("%d%d%d",&t,&cp,&me);
while(t--){
scanf("%d%d%d",&an,&cpt,&met);
if(an!=0&&k==0){
j=1;
k++;
}
if(cpt>cp&&k==0){
j=2;
k++;
}
if(met>me&&k==0){
j=3;
k++;
}
}
if(j==1){
printf("WA");
}
else if(j==2){
printf("CLE");
}
else if(j==3){
printf("MLE");
}
else{
printf("AC");
}
return 0;
}
``````

@Burn_Fireblaze The hint is in this topic. Check out the earlier discussions. My code passes all uDebug cases

I checked out earlier discussions and don’t find any hints.

You mistakenly wrote WR.

@Burn_Fireblaze You didn’t submit the code yet, did you?

I test clicked on the test button and it showed WA on the test case 2.

submission id 340687

Oh. You mean it’s one of the sample I/O.

You then know what the input is for test case 2 and what the expected output should be. Why not check your code to see why it is failing for that case then?

Wow, this is really fast. Thanks for your reply Now getting wrong answer on test case 6 I think your order is wrong, follow this order taken from the problem statement,

• `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.
2 Likes