Editorial for COCI '09 Contest 7 #3 Bakice
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
We precompute all distances between seats and rude passengers. We now repeatedly find the smallest global distance. We check to see what seat and passenger is in question. We find all other passengers equidistant to the seat, and then eliminate them all. We increment explosion counters as needed. Repeat until we run out of chairs, or passengers, or both.
Comments