What I learned from getting Wrong Answers on Codeforces

Правка en1, от yesugarisaicharanreddy, 2026-10-01 03:18:37

What I learned from getting Wrong Answers on Codeforces

When I started solving Codeforces problems, I was getting Wrong Answer quite often. Sometimes the code looked completely correct to me, but it still failed on one of the hidden tests.

After getting a lot of WAs, I started noticing some common mistakes in my own solutions.

  1. I was sometimes not reading the constraints properly. Now I check the constraints before deciding the approach.

  2. I was making assumptions from the sample cases. The sample may work even when the logic is wrong, so now I try to create my own small test cases.

  3. I was making indexing mistakes, especially with 0-based indexing. Now I manually check the first and last few positions before submitting.

  4. Sometimes I was using int when the answer could become much larger. Now I check the maximum possible value and use long when needed.

  5. I sometimes misunderstood one part of the statement and started coding immediately. Now I try to explain the problem to myself in simple words before writing the code.

  6. After getting WA, I used to change random parts of the code. Now I first try to find a test case where my logic actually fails and then fix that specific mistake.

  7. I was also ignoring edge cases such as n = 1, all elements being equal, already sorted arrays, or minimum and maximum values.

These things look simple, but they made a noticeable difference in my practice.

I am still learning competitive programming, but getting WAs and understanding why they happened has probably taught me more than just solving problems without mistakes.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский yesugarisaicharanreddy 2026-10-01 03:18:37 1674 Initial revision (published)