시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 17 | 9 | 9 | 75.000% |
We have to create a computer program that will calculate the ranking of football teams after a certain number of matches in the league have been played.
For each played match, the team gets 3 points for a win, 1 point for a draw and 0 points for a loss.
The ranking is determined by the following rules:
Write a program that will determine the ranking of teams in the league.
First line of input contains two integers N and K, 1 ≤ N ≤ 100, 1 ≤ K ≤ 1000, number of teams and number of played matches. Teams are designated with numbers from 1 to N.
Following K lines contain the description of played matches, in the format 'A B C:D'. This means that teams A and B have played their match, and team A scored C goals while team B scored D goals, 0 ≤ C, D ≤ 9.
First and only line of output should contain ranking of the league, from the best team to the worst team.
3 2 1 2 0:3 2 3 3:1
2 3 1
3 3 1 2 1:3 2 1 2:2 1 3 4:0
2 1 3
5 4 1 5 1:0 2 3 2:1 3 4 3:0 4 5 1:1
2 3 1 5 4