Correct Answer on my home computer, but wrong in the codechef judge


I am new to this platform, and I am participating in July Challenge 2018 (my first competition here) I tried submitting a solution to the first problem, but the judge gives wrong answer (WA) as its verdict. I compile the same in my home computer and it works perfectly fine there. I know, I am not supposed to post the solutions to ongoing challenges here, but what where am I going wrong?

General advice to new programmers at codechef :
print the answer in exact same format as asked in question… (Don’t print please enter this and that)
Please check for corner cases and try testing your logic for different random inputs and think about missing corner case in your soln…
Can’t help more as it is a live contest… ping me after contest if u still have any query…

Full test data is not revealed. Your solution runs for critical inputs for which it is/might be giving wrong output. Also, superflous print statements give wrong answer, as its a machine checking for an exact match between whats asked and what you print.

1 Like

is it regarding the magic set question because the question is not explained well and the test case is explained for n=2 i asked in the comment section of the question to explain a test case with n=5 so that we can understand the question properly still no reply yet

1 Like

ahh solved it finally the test case should be explained in detail

They will probably reply in once in a day…

Probably you have not made initialisation for some variables, and your compiler initialises them to zero but then Codechef judge doesn’t.