Editorial for COCI '07 Contest 6 #1 Parking
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.
The task can be solved by simulation. We need to keep track of how many trucks are in the rest area.
For every minute between and , we:
- Add the number of trucks arriving during that minute.
- Subtract the number of trucks departing during that minute.
- Charge for parking based on the number of trucks parked.
Comments