This part is really confusing. As I understood..Ballot papers on which an eliminated candidate is mentioned are effectively modified by deleting that candidate, thereby ``promoting" any lower-preference non-eliminated candidates. (A valid ballot from which all candidates have been eliminated remains a valid ballot.)
Suppose there are three candidates numbered from 1 to 3 and the ballots are described as
Code: Select all
1 3 2
2
1 2
2 3
3
Code: Select all
1. got 2 votes
2. got 2 votes
3. got 1 vote and thus eliminated
Code: Select all
1 2
2
1 2
2
// There is no candidate
Now look at the 5th ballot. Its empty. As the problem states (A valid ballot from which all candidates have been eliminated remains a valid ballot.), so the 5th ballot is also valid. But it is empty so, it will not be counted.
And for the input
Code: Select all
1. Chubby Checker
2. Kid Creole
3. Rest of the coconuts
1
1
2
3
Code: Select all
1. got 2 votes
2. got 1 vote
3. got 1 vote
Code: Select all
1
1
empty
empty
Remember that...
1. In a valid ballot the occurrance of any number is at most 1. If more than 1 then the ballot is not valid. So a ballot like 1 2 1 1 is invalid.
2. Suppose there are 3 candidates numbered from 1 to 3. Then a ballot like 1 2 4 is invalid.
Hope it helps.