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

Автор Cyclonestopper9000, история, 6 часов назад, По-английски

During Codeforces Round 966 Div.3, I was writing a solution to problem B. During the contest, I had come up with this code: https://ide.usaco.guide/O4IVEpEkaUruFQ_sq5c.

However, it gave me a "YES" for the fourth subcase in the sample test case. I searched everywhere in the code for what might be giving an answer like this, but I found nothing.

To fix this, I tried what seemed like a completely arbitrary thing: create a vector of the bus seatings beforehand, then figure out if the seating is valid. To my complete surprise, this worked, as can be seen in this submission: https://mirror.codeforces.com/contest/2000/submission/276167020.

I still can't identify what the major difference between the two codes is, so I was wondering if anybody could help me find the error.

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

»
6 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Cyclonestopper9000 (previous revision, new revision, compare).

»
6 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

that's like the official solution man, what do you mean?

»
5 часов назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

I made the same mistake and spent 20 minutes debugging, oops. The issue is that you break the loop before you cin all the x. Just remove the break and it should work.