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. Complete Reference to Competitive Programming | HackerEarth
  2. How to start Competitive Programming? For beginners! - YouTube
  3. Programming Competitions (Codeforces, Code Jam, ...) - YouTube
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 - #6 by striker22

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: Solve Coding Problems Online - CodeChef

2 Likes

there are many test inside🤔you need to cross all

1 Like