Contest Postmortem
If a chessboard position can be evaluated and assigned a numerical value, then it should be
possible to do the same for a contest problem set. The following rules outline one possible
scoring system:
-
Fairness: One point if every problem has been solved by at least one team.
-
Inclusiveness: Two points if more than 90% of the teams solved a minimum of two problems.
-
Challenge: Two points if no team solved all the problems.
Your task is to write a program to score a problem set based on the above rules.
Input Specification
The input consists of multiple test cases. Each case starts with two integers on a separate
line. The first integer C (10 ≤ C ≤ 100)
represents the number of teams in the contest, and the second integer P
(8 ≤ P ≤ 20) represents the number of problems in
the set. The last case is followed by a line containing two zeros that indicates the end of
the input data and should not be processed as a valid case. Each of the next C lines
describes the performance of a single team. Each such line starts with the name of a team
followed, after a blank space, by P integers. The k-th integer
(1 ≤ k ≤ P) has a value of one (1) to
indicate that the team has solved the k-th problem, or zero (0) otherwise.
Output Specification
For each contest, print the contest number (starting with 1, and using the format in the
sample) followed by an integer indicating the calculated score.
Sample Input
10 8
Gladiators 1 1 1 1 1 1 1 1
Just4Pizza 1 1 1 1 1 0 1 0
The_greatests 1 1 1 0 1 0 0 0
2+1=us 1 0 1 0 0 1 0 1
we_are_1+2 0 0 1 1 0 1 1 1
random 1 0 0 0 1 1 1 1
cfjaszmubdfub 1 1 0 0 1 1 0 1
wbkdfevtmismxg 0 1 0 1 1 1 0 0
soxkukbmirk 0 1 1 0 0 1 0 0
axoqjkpwequsara 0 1 0 0 0 0 1 1
10 8
Gladiators 0 1 0 1 1 0 0 1
Just4Pizza 0 1 1 1 1 0 0 0
we_are_1+2 0 0 1 0 1 0 0 0
random 0 0 1 0 1 0 1 0
ugjzbdglfbktscq 0 1 0 0 0 0 0 1
vxxltjgrexz 0 0 0 1 0 0 1 0
xqapfogqfilqbta 0 1 1 0 0 0 1 0
mbgjlmcgmkkan 0 1 1 0 0 0 1 0
The_greatests 0 1 0 0 0 0 0 0
2+1=us 0 0 0 0 0 1 1 0
10 8
Gladiators 0 0 1 0 1 0 0 0
Just4Pizza 0 1 1 0 1 1 0 0
random 1 0 0 0 0 1 1 0
we_are_1+2 1 1 1 1 0 1 0 1
2+1=us 0 1 1 1 1 0 1 0
zumwuoezqqcmmc 1 0 1 1 0 0 0 0
fqabkrsrjg 0 1 0 1 1 1 0 1
pocdkprlpeva 1 0 1 0 0 1 1 0
The_greatests 0 0 0 0 0 0 0 1
nurtvuldyyrsa 1 1 1 1 0 1 1 1
10 8
Gladiators 1 1 1 1 1 1 1 1
Just4Pizza 0 0 0 1 1 1 0 0
The_greatests 0 0 0 0 0 0 0 0
we_are_1+2 1 1 1 0 1 0 1 1
random 0 0 1 1 0 0 1 0
ytypiowjhsok 0 1 1 0 0 1 0 0
gxvelxfbprutp 1 1 1 1 1 0 0 1
bdahyifafvrtzrc 0 0 1 1 1 1 1 1
2+1=us 1 0 1 0 0 1 1 1
koyzvguhyj 1 0 1 0 1 1 1 1
0 0
download as text file
Output for Sample Input
Contest 1: 3
Contest 2: 2
Contest 3: 3
Contest 4: 1
download as text file