Trying out codechef challenge but unable to submit correct solution

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

1 Like

Well welcome to the world of competitive programming.

9 Likes

Can you suggest what should i do? I solved 2 challenges but no submission :slightly_frowning_face: ( @striker22

That’s because there are some corner cases for which your code gives a wrong answer. Check your code for such boundary conditions.

1 Like

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.

1 Like

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:

  1. https://www.hackerearth.com/getstarted-competitive-programming/
  2. https://www.youtube.com/watch?v=xAeiXy8-9Y8&t=499s
  3. https://www.youtube.com/watch?v=cpguolx2oms
1 Like

Thank you everyone :slight_smile:

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.

Refer this: Trying out codechef challenge but unable to submit correct solution

1 Like

@thunderman_33 @maleeha_12

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: https://www.codechef.com/problems/school?sort_by=SuccessfulSubmission&sorting_order=desc

2 Likes

there are many test inside🤔you need to cross all

1 Like