Trying out codechef challenge for the first time. If i try out the solution with custom input ,it works fine but when i submit it ,it says WA? Why is that ? I gave multiple custom inputs and it worked as expected. Happened twice,very frustrating.What am i doing wrong?Help please
Well welcome to the world of competitive programming.
That’s because there are some corner cases for which your code gives a wrong answer. Check your code for such boundary conditions.
Critically analyze your code and try to generate a case which could possibly fail your code(usually corner cases). In some time you will reach a point when you would have managed to generate a AC code.
See there are a lot of scenarios because of which your code is giving WA but do not come into the impression that if your code gives the right answer to custom input means it is a correct solution. Moreover, you mentioned that you are getting WA means there is some problem in your code.
Debug your code by generating test-cases (edge cases) by taking a hard look at the given constraints.
If you are new to competitive programming which I guess you are refer to following links:
Thank you everyone
best answer one could give
exactly same happening to my code ( first contest ).
what i am doing wrong , i am not getting the point why i am getting WA.
There are some corner cases that you might be missing for which your code gives a wrong answer.
You must practice some basic questions. Refer this: Solve Coding Problems Online - CodeChef
there are many test inside🤔you need to cross all