
ZOJ Problem Set  1751
The judges at the programming contest have been watching the Olympics, and are considering using style judging at next year's contest. Particularly, they like the model used in the diving competition where each problem is given a degree of difficulty and then six judges will give it a score on a scale from 0.0 to 10.0. The high and low score will be discarded, the other four scores added up, and then the sum is multiplied by the degree of difficulty. The team with the highest total score for all their problems is declared the winner. Your job for this problem is to write a program that will read in the number of teams and problems, each problem's degree of difficulty, and the problems that are submitted by each team at an actual competition along with each of the six judges' scores for those problems. The program will then print a summary showing each team's score on each of the problems along with the winning team number and their score. A team is allowed to submit a problem more than once without penalty, but the judges' scores for the most recent submission are the ones that are used. In case more than one team has an overall score within three hundredths of a point of the high score, your program should indicate there is a tie and list the teams with multiple high scores. Input The input file will consist of data sets for one or more contests. Each data set will begin with a single integer 0 <= n <= 9, representing the total number of teams competing in the contest. This will be followed by a line that begins with an integer 0 < p <= 9 indicating the number of problems at the competition, and then p numbers representing the judges' difficulty ratings for each of the problems. Each of the difficulty ratings is a nonnegative fixed point value with exactly one digit after the decimal point. All judges' scores are fixed point numbers in the range from 0.0 to 10.0 with one digit after the decimal point. The next lines contain a team's submission and the six judges' scores for that submission in the following format : TeamNumber ProblemNumber Score1 Score2 Score3 Score4 Score5 Score6 The end of input for a given contest is indicated by the string "TIME'S UP" starting in column 1. A line of "END" starting in column 1 indicates end of input and should not be processed.
Contest 1: 1 2 3 1 50.4 45.6 50.2 2 50.4 51.3 54.9 3 50.4 0.0 44.1 4 0.0 55.1 50.4 Team 2 wins with 156.6 points Source: Southeast USA 2000 