Problem G
Input: Standard Input
Output: Standard
Output
So, here comes another cricket tournament –
You are given the current league table of the tournament.
For example, let’s say there 4 teams in the tournament – Dhaka,
Team Wins Loss Left Dhk Ctg Raj Khl
-----------------------------------------------------------------------------------------
Rajshahi 10 4 4 0 4 0 0
From the table, you can see that
Input will consist of less than 30 test cases. First line of each test case will contain no of teams in the tournament, N (1<N<51). Then there will be a table in the format mentioned above except for the headers. It will consist of N rows and N+4 columns. Each row will represent a team. Team names don’t have any spaces in them and they will be at most 30 characters in length. Last N columns of the table constitute the ‘Remaining Game Matrix’ which is symmetrical and its diagonal entries are always zero. No. of rounds, R (0<R<31) will not be explicitly mentioned in the statement. The last test case will be followed by a -1 in a line by itself, denoting the end of input file.
For each test case, you should print “Case C:” in the first line where C is replaced by the case number starting from 1. Then, for each team eliminated, you should output a block of 5 lines which should be in the following format –
Team X is eliminated.
They can win at most a + b = c games.
T1, T2, … and Tn
have won a total of G games.
They play each other M times.
So, on average, each of the teams wins (G+M)/n = p
games which is greater than c.
Here,
X is the name of the team which is eliminated.
a, b and c are the no. of games team X has already won, no. of remaining games and their total wins optimistically respectively.
T1, T2, … and Tn are the n team names you think will mathematically beat team X as a combination. G is their total match won already. There will be M matches between these n teams.
Print a blank line after each such block. Print an extra blank line after each test case.
If there are multiple groups that satisfy the condition, you can output any one. Also you can output teams in any order. Output will be checked by a special judge program. For floating point number (only p), you can print any number of digits after the decimal point provided it does not differ by more than 1E-6 from the original value.
Sample Input
Output for Sample Input
4 A 6 7 5 0 0 0 5 B 10 4 4 0 0 4 0 C 10 4 4 0 4 0 0 D 1 12 5 5 0 0 0 2 A 1 1 1 0 1 B 1 1 1 1 0 -1 |
Case 1: Team A is eliminated. They can win at most 6 + 5 = 11 games. B and C have won a total of 20 games. They play each other 4 times. So, on average, each of the teams wins (20+4)/2 =
12.000000 games which is greater than 11. Team D is eliminated. They can win at most 1 + 5 = 6 games. B have won a total of 10 games. They play each other 0 times. So, on average, each of the teams wins (10+0)/1 =
10.000000 games which is greater than 6. Case 2: [the line above is blank] |
Note: Though the output blocks are supposed to be of 5 lines, you see in the sample output to span them to 7 lines which is due to formatting in word. You should output in 5 lines on your output.