#P8364. [COI 2009] IZBORI
[COI 2009] IZBORI
Problem Description
There are voters voting in an election. In this election, parties participate and compete for seats in the parliament.
Assume the parties are numbered from to , and they receive votes respectively. Seats are allocated as follows:
-
Any party that gets less than of the votes is directly disqualified from further seat allocation.
-
At the beginning, no seats are reserved for any party.
-
For each party, compute , where is the total votes received by the party, and is the number of seats already allocated to that party.
-
The party with the largest gets one seat. (If tied, the party with the smaller index gets it.)
-
Repeat steps 3 and 4 until all seats are allocated.
Now some ballots have been counted, and the current vote counts of the parties are known. Write a program to determine, over all possible situations, the maximum or minimum number of seats each party can obtain.
Input Format
The first line contains three positive integers .
The second line contains positive integers, the current vote counts of each party. It is guaranteed that their sum does not exceed .
Output Format
Output integers on the first line, the maximum possible number of seats each party can obtain.
Output integers on the second line, the minimum possible number of seats each party can obtain.
20 4 5
4 3 6 1
3 3 3 2
1 0 1 0
100 3 5
30 20 10
4 3 3
1 1 0
Hint
Correctly outputting the first line earns of the score. Correctly outputting the second line earns of the score.
Constraints: , , .
Translated by ChatGPT 5