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://codeforces.net/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.
Auto comment: topic has been updated by Cyclonestopper9000 (previous revision, new revision, compare).
that's like the official solution man, what do you mean?
I previously put the wrong code in the ide. I fixed it now.
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.
oh, thanks, that makes sense!