Dream Team X26443


Statement
 

pdf   zip

thehtml

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.

Public test cases
  • Input

    john peter sonny jack roger 78 66
    peter jack marvin harry sonny 45 99
    marvin sonny roger peter jack 87 79
    peter jack john sonny roger 55 72
    gary frank roger john peter 77 76
    james  jack marvin john sonny  88 19
    john peter sonny jack roger 92 81
    gary frank roger john peter 109 106
    
    

    Output

    jack john peter roger sonny 2/3 225 219
    frank gary john peter roger 2/2 186 182
    jack james john marvin sonny 1/1 88 19
    jack marvin peter roger sonny 1/1 87 79
    harry jack marvin peter sonny 0/1 45 99
    
  • Input

    john peter sonny jack roger 78 66
    marvin sonny roger peter jack 87 89
    roger peter frank john gary 91 42
    peter jack john sonny roger 55 72
    gary frank roger john peter 77 76
    james  jack marvin john sonny  88 19
    john peter sonny jack roger 92 81
    gary frank roger john peter 109 106
    frank roger peter john gary 71 92
    
    

    Output

    frank gary john peter roger 3/4 348 316
    jack john peter roger sonny 2/3 225 219
    jack james john marvin sonny 1/1 88 19
    jack marvin peter roger sonny 0/1 87 89
    
  • Information
    Author
    Language
    English
    Official solutions
    Python
    User solutions
    Python