Strange code

Revision en2, by Cyclonestopper9000, 2024-08-15 03:50:57

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Cyclonestopper9000 2024-08-15 03:50:57 0 (published)
en1 English Cyclonestopper9000 2024-08-15 03:50:42 800 Initial revision (saved to drafts)