Dream Team

A basketball coach needs a program to decide which are the best five players in his team.

For that, we have a history of matches. For every match we have the 5 players who played it, and the score of the match.

The coach wants to find out which is the best team, that is, the one that that won more games. If there is a tie, the group with the higher total point difference (points scored minus points against), if the tie persists, the group with more points scored. Assume there will be no ties beyond that.

Input

The input is a sequence of match results. Each match consists of 5 player names followed by two integers: first points scored by the team, second points scored by the opponent.

Output

The output is the list of the teams that played some match, sorted from best to worst. Best team is that winning a larger number of games. In case of a tie, the one with a larger difference between points scored minus points lost. If the tie persists, the group with more points scored.

For each team in the output list, the program must print the names of the players in alphabetical order, followed by the number of won matches over the number of played matches, then the total number of points scored, and the total number of points against. Check the format of the examples.

Problem information

Author: Lluís Padró

Generation: 2026-01-25T13:59:33.542Z

© Jutge.org, 2006–2026.
https://jutge.org