Editorial for COCI '11 Contest 3 #2 D'hondt
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.
As we read input data, we immediately check if this party won more than of the total number of votes. If it did, we add fourteen entries to some sequence. Each entry should contain this party's identifier letter, and a number of votes divided by an integer in range to .
We now sort this sequence in descending order of calculated quotients, and take a look at the first entries. Among these, we must count how many times each party appears. We must be careful to output all the parties that had more than of the votes, and to output them in sorted order.
Comments