0gnjen1's blog

By 0gnjen1, history, 3 months ago, In English

Today I spent a few hours solving problem C from the Codeforces Round 917. Most of the time was spent on me not understanding why my code won't work even after spending a lot of time trying to find the bug. It turned out to be a really weird 'bug' which I really can't understand. I managed to fix the code and get AC in the end but it was basically on accident.

I will put comments next to the lines of code that I changed so you can find your way around my messy code a little more easily.

Submission for code 1 right here

Code with the 'bug'

Submission for code 2 right here

Code without the 'bug'

I know using a vector was redundant but I don't see a single reason why it gives a wrong answer? I really hope someone with more knowledge will be able to help me understand why this was happening so I can avoid a similar bug in the future :D

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it