CCO '01 P6 - Election Night

View as PDF

Submit solution

Points: 7
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
Canadian Computing Competition: 2001 Stage 2, Day 2, Problem 3

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.

Input Specification

The 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.

Output Specification

For each candidate numbered X, in ascending order, print one of the following messages, as appropriate.

Candidate X will become president.
Candidate X may become president.
Candidate X will not become president.

Output a blank line after each test case. The input ends with a line indicating 0 states and 0 candidates.

Sample Input

4 5
3 1 2 3
3 1 3 4
1 2
1 2
0 0

Sample Output

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.

Comments

There are no comments at the moment.