Editorial for COI '08 #1 Izbori
Submitting an official solution before solving the problem yourself is a bannable offence.
The first subtask (finding the largest number of parliament seats for a party) is solved by simulation. For each party, we assume it receives all outstanding votes and then use the D'Hondt method to calculate the number of seats won. The time complexity is
The second subtask is more difficult. The solution is based on dynamic programming and binary search.
For each party, we are asked to calculate the smallest number of seats it can win, assuming the least favourable distribution of remaining votes. Parties that initially have less than
If the remaining votes can be distributed so that a party wins
That question can be answered by a dynamic programming algorithm. The function
Comments