2001 Canadian Computing Competition, Stage 2
Day 2, Problem 3: Election Night
The nation of Cicoci elects its president using a winner-take-all electoral vote system. Each of the N states has one electoral vote, and that vote is awarded to the candidate receiving the highest popular vote in that state. The candidate with the most electoral votes is elected president. If there is a tie, no president will be elected, a constitutional crisis will ensue and the country will be plunged into civil war.
As election returns are tabulated it becomes possible to determine the outcome of the vote in a number of states. But many remain too close to call. You have been retained by Cicoci Press (CP) to compute the possible winners and losers.
InputThe input may contain several test cases. The first line of each test case contains two positive integers: the number of states, followed by the number of candidates. Neither exceeds 100. For each state there is a line stating the number of candidates who might yet win the state, and a list of the identifiers of the candidates who might yet win the state. Candidates are identified by consecutive integers starting from 1.
OutputFor each candidate numbered X, in ascending order, print one of the following messages, as appropriate.
Output a blank line after each test case. The input ends with a line indicating 0 states and 0 candidates.Candidate X will become president. Candidate X may become president. Candidate X will not become president.
4 5 3 1 2 3 3 1 3 4 1 2 1 2 0 0
Candidate 1 will not become president. Candidate 2 may become president. Candidate 3 will not become president. Candidate 4 will not become president. Candidate 5 will not become president.
Point Value: 30
Time Limit: 2.00s
Memory Limit: 16M
Added: Apr 18, 2009
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3