Editorial for IOI '09 P3 - POI
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.
This problem is intended as a straightforward implementation exercise. After the data is loaded from the file, a first pass over it can be used to count the number of people not solving each task (and hence the number of points assigned to each task). A second pass then suffices to determine, for each contestant, the number of tasks solved and the score.
It is not necessary to completely determine the final ranking: Philip's rank is simply the number of contestants that appear before him in the ranking, plus one. This can be determined by comparing each contestant to Philip. A contestant will appear ahead of Philip in the ranking if and only if:
- has a higher score than Philip; or
- has the same score as Philip, but has solved more tasks; or
- has the same score as Philip and has solved the same number of tasks, but has a lower ID.
Comments