Hi, I’d like to ask everyone why this kind of stuff happens. I did solve 2 questions in different events. I was able to get the logic and I can gurantee you that my solution was absolutely correct. The question had mentioned to print output with error of less than 10^-6 will only be accepted. So I did print my output carefully using double precision ( which means 10^-11 ) which was quite less than the error given in the question i.e., I did use a double datatype variable for solving the equations and getting the value.
Now the worst part happens. The judge gives me wrong answer and I waste my time wondering where I went wrong?! This happened with me on 2 different occasions. In first one, I cracked my head but to avail penalty but no AC! :’(. In the second one, Instead of cracking my head I did just change the language on which I did code. First I coded with java/cpp and got wrong answer and then suddenly switched to Python 3.5 (not py2.7 or cpython) and voila!!! It just got accepted. The same code with same logic and it is accepted. What in the world the language just made the difference? I believe Codechef should also tell us whether our sample test cases are working or not while running the code (but not submitting to online judge).
But first I’d like to know the reason. Thanks if you can help me.
Eg Write a program for solving a quadratic equation’s root. You’re given the value of a,b and c of the equation ax^2+ bx +c =0.
The judge assumes the answer is right if the error is below 10^-6.
I/P 1 4 4 O/P -2 -2 I/P 1 4 3 O/p -0.394448 -7.6055512 I/P 9 6 1 O/P -0.333333 -0.333333 I/P 9 6 0 O/P 0 -0.666666 **Note that the question is different and I am just mimicking that with it. **