What is this Judge Error, Please clarify?

I solved my first Codechef problem and submitted it, but it shows judge error? I don’t understand what seems to be the problem?

Hey @aakash_rohila - can you share the problem link here. I ll try and help you debug this.

1 Like

Hi, this is the problem statement:

https://www.codechef.com/LP1TO201/problems/CHFRICH

I am still getting judge error while submission…
Regards.

The number of test cases can be as big as 21000. So, the size of all the arrays you declared in your solution should be at least 21000. Here’s an Accepted solution.

1 Like

Hey bro, saw your solution to the problem. Just a constructive criticism, that is NOT the right way of handling the testcases.
Whenever you have testcases to answer, make sure that you put the logic in a loop.
For eg, lets say I have “t” testcases to solve for any random problem, then i would write the logic for one testcase and then wrap that logic in a loop which runs t times:

PROGRAM:

int t;
cin>>t;
while(t–){
// LOGIC TO SOLVE THE PROBLEM FOR A SINGLE TESTCASE
}

I hope that it helped, don’t worry! Since it is your first problem on codechef, you will probably get stuck. All the best on your journey of Competitive programming :slightly_smiling_face:

1 Like