401822: GYM100534 E Volleyball

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Volleyballtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

The FIVB Volleyball World Championship is an international men's and women's indoor volleyball competition. It is the oldest and most important of all the international events organised by the FIVB and must not be confused with the World Cup, World Grand Champions Cup, or the World League/World Grand Prix. The competition formula of the FIVB World Championship has been constantly changed to fit the different number of teams that participate in each edition. The following rules usually apply: Twenty-four teams participate in each event. To participate in the event, a team must survive a number of qualification tournaments depending on its position in the FIVB World Rankings. Low-ranked teams may have to engage in up to three tournaments to be granted a berth; high-ranked teams typically play only one. The competition is divided in two phases: a preliminary round and a final round. In the preliminary round, teams are organized in pools. Each team plays one match against all other teams in its pool. When all the matches of the preliminary round have been played, the top 4 teams in each pool qualify for the following round(s), and the remaining ones leave the competition. The FIVB has tried various different formats for the final round(s). For some years now (2004), there seems to be a consensus that at least semifinals and finals must be played according to the Olympic format. Quarterfinals consist of groups of teams playing against each other. The tournament implements very tight line-up restrictions: only twelve players are allowed, and no replacement is permitted, even in case of injuries. The 2014 FIVB Volleyball Men's World Championship was held in Poland from 30 August to 21 September 2014. The tournament featured 24 teams to determine the world champions in men's volleyball. In addition to host nation Poland, 23 teams qualified for the tournament by means of continental and regional competitions. The matches took place in seven venues across seven Polish cities, with the final being held at the Spodek, Katowice. We have result of the last match between any two teams attending World Championship and we want to predict the Champion. We assume the result of a match between any two teams would be the result of their last match against each other (the result of their last match before Championship). Pool rankings The team rankings per pool are determined by the points total after all matches have been played. Match won 3-0 or 3-1: 3 points for the winner, 0 point for the loser. Match won 3-2: 2 points for the winner, 1 point for the loser. In case of tie, the teams will be classified according to the following criteria: number of matches won, points ratio and sets ratio

In the event of a tie at the end of each Round in the number of points scored by two or more teams, the teams will be classified according to the following criteria: 1. Number of Matches won. 2. Point ratio. Quotient resulting from: total number of points scored / total number of points lost. 3. Set ratio. If there is still a tie after applying the two criteria described above, the teams will be ranked by the quotient resulting from: total sets scored / total sets lost. In the first round each team plays against each of the other 5 teams in its pool. After the end of the first round first 4 teams of each pool qualify for the next round. At the second round first 4 teams of pool A and first 4 teams of pool D are grouped together in pool E, and first 4 teams of pool B and first 4 teams of pool C are grouped together in pool F. In the second round each team plays against each of the other 7 teams in its pool. After the end of the second round. first 3 teams of pool E and first 3 teams of pool F are qualified for the third round. In the third round 6 teams that have qualified for this round are sorted according to pool standing procedure (they don't play against each other, they are just sorted according to their data from second round) and teams ranked 1, 4, 6 are grouped together in pool G and teams ranked 2, 3 and 5 are grouped together. In the third round each team in pool G and pool H plays against two other teams. After the end of the third round first 2 teams of pool G and H are qualified for semi-final round. Team ranked 1 in pool G plays against team ranked 2 in pool H and team ranked 2 in pool G plays against team ranked 1 in pool H. The winner of these two games are qualified for the final game, and finally the champion will be revealed after they play against each other in the final game.

Input

First 4 lines of input describes 4 pools each consisting of 6 teams. Names of each team is composed of lowercase English letters. a1 a2 a3 a4 a5 a6 b1 b2 b3 b4 b5 b6 c1 c2 c3 c4 c5 c6 d1 d2 d3 d4 d5 d6 Next (23*24)/2 lines of input consist match results in this format. teamA teamB setsWonByTeamA setsWonByTeamB resultOfTheFirstSet resultOfTheSecondSet ... For example : Iran Brasil 3-2 25-23 24-26 27-25 12-25 15-9 ...

Output

Print the name of the Champion.

ExamplesNote

Because of large input, input of this problem has been erased. Use your imagination!

加入题单

算法标签: