2000 ACM South Central Regional Programming Contest

Louisiana State University

Problem #6: The Tournament

Introduction

My Uncle Lester is known throughout Lafayette Parish as the luckiest man around. He has picked the winners of the last 7 NCAA Basketball Championships. During Mardi Gras last year, I got Uncle Lester to explain exactly how he is able to consistently pick the winners of this event. He is convinced that if you rate teams' offense and defense on a scale of 1 to 10 and then multiply their offensive rating by 5 and subtract double their opponents defensive rating, you will have calculated that teams score if that team played their opponent. (Keep in mind that if a score is not an integer, then that score will be rounded to the nearest whole number.) I told Uncle Lester that this could result in negative scores and he told me that was true, but the eventual outcome is accurate. Whoever has the greatest score will win the game and continue on to the next round.

If one team beats the other team by more than 10 points, the winning team's offensive rating will increase by .5. A tie score will result in the winner being the team with the mascot name which would appear first in alphabetical order between the two teams.

As you may know, the NCAA seeds all teams in the tournament. They seed the teams according to their offensive rating. The higher the offensive rating is, the lower the seed is. If more than 1 team has the same offensive rating, then the school mascot names are sorted in alphabetical order with the first team in the list getting the next lowest seed number available. For example, if in determining seed 3, a team with mascot name Bananas has the same offensive rating as a team with mascot name Mangoes then Bananas would be awarded seed 3 position. The tournament bracket is laid out where the highest seeded team plays the lowest seeded team, the second highest seeded team plays the second lowest seeded team, and so on. The winner of the first two games play each other and so on.

 1 Team  1
          |-Winner1
16 Team  2         |- Winner9
 2 Team  3         |        |
          |        |        |
          |-Winner2         |
          |                 |
15 Team  4                  |-Winner13
 3 Team  5                  |         |
          |-Winner3         |         |
          |        |        |         |
14 Team  6         |-Winner10         |
 4 Team  7         |                  |
          |-Winner4                   |
          |                           |
13 Team  8                            |-Winner15
 5 Team  9                            |
          |-Winner5                   |
          |        |                  |
12 Team 10         |-Winner11         |
 6 Team 11         |        |         |
          |-Winner6         |         |
          |                 |         |
11 Team 12                  |-Winner14
 7 Team 13                  |
          |-Winner7         |
          |        |        |
10 Team 14         |-Winner12
 8 Team 15         |
          |-Winner8
 9 Team 16

With all of Uncle Lester's theories, and the NCAA's rules for tournament seeding, who will win the next NCAA Basketball Championship, and what will the final score be?

Input

Input will consist of n data sets in the following format:

Output

The output will be the name of the tournament champion and the score of the final game followed by a new line. The final score will be the two scores separated by a minus sign. The champion's score will be first in the sequence.

Sample Input

16
LOU,Snorks,7,8
LSU,Tigers,9,6
OU,Sooners,6,7
TAM,Aggies,4,9
UT,Longhorns,8,3
BU,Cubs,4,4
ACM,Hackers,8,4
IEEE,Techs,7,7
MIA,Soldiers,3,3
MIB,Aliens,6,9
TUG,Warriors,3,8
TNG,Trekkies,4,4
CIA,Agents,5,7
FBI,Gmen,6,6
WWF,Wrestlers,3,5
MAY,Flowers,2,5
4
IBM,Judges,5,5
UPS,Drivers,7,3
TKO,Fighters,8,4
YMCA,Villagers,7,4

Sample Output

LSU 34-26
TKO 35-27