Блог пользователя 0gnjen1

Автор 0gnjen1, история, 4 месяца назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится