Chess tournament P64031


Statement
 

pdf   zip

html

Write a program that given the results of the matches of a chess tournament, prints the names of the players in alphabetical order and next to each name, the number of wins, draws and defeats.

Input

Input consists of the number n of players followed by n strings with the player names. Then, it follows zero or more match results. Each match result is represented by three strings. First two are the match player names. The third string can be ’1-0’ (first player is the winner), ’0-1’ (second player is the winner) or ’1/2-1/2’ (for a draw). The number of players n is always greater than 1.

Output

In alphabetical order and for each player, a line with the name and numbers of wins, draws an defeats as it is shown in the examples.

Public test cases
  • Input

    5
    Marta Juan Pedro Ana Javier
    Marta Pedro 1-0
    Ana Juan 1/2-1/2
    Pedro Juan 0-1
    

    Output

    Ana 0 1 0
    Javier 0 0 0
    Juan 1 1 0
    Marta 1 0 0
    Pedro 0 0 2
    
  • Input

    2 alice bob alice bob 1/2-1/2 
    bob alice 0-1 alice bob 0-1 
    

    Output

    alice 1 1 1
    bob 1 1 1
    
  • Information
    Author
    Proal
    Language
    English
    Official solutions
    Python
    User solutions
    Python