Cyclonestopper9000's blog

By Cyclonestopper9000, history, 4 months ago, In English

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.

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 months ago, # |
  Vote: I like it +5 Vote: I do not like it

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.