How do we know at which number of test case is our program failing ?

I submitted two programs A and B. Is there a way to know that B has cleared more test cases than A and i am going in right direction. Is “Time” of program execution is reliable for it. ?

2 Likes

If a solution is wrong, its wrong.

Now it is not necessary that if your solution A passed 4 testcases (with overall program execution time tA) and your solution B passed say 3 (tB) and tA > tB then solution A is in the right direction, not at all necessary.

Therefore, deducing what to do in order to fit all the input/output constraints is better than how correct/wrong you are.

3 Likes

There is a cheat how to find the ID of test file where you get WA (it not works for TLE).

At C++ it could be implemented as follows:
write

clock_t start = clock();

at the beginning of the execution.

And then add dummy loop

while (clock() - start < (TL - 0.01) * CLOCKS_PER_SEC);

at the end, where TL is the time limit for the problem.

Then execution time of your program will be very close to some multiply of TL.
Dividing it by TL you will get the required test ID.

27 Likes

You may find another hack here: http://www.amolbhave.in/computers/exploting-codechefs-error-reporting-mechanism/

that’s abolutly perfect

one of the best illustrations for “you can do miracles if you know how to express mathematics via programming”

1 Like