Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
Team Standings
Question:
Turkish National Football association wants to prepare an automatic system to calculate the
team standings. The system is going to read the results of matches, then it will prepare the
team standings. If a team scores more goals than the other team, it wins the match and gets 3 points.
If they have equal number of goals, then the match is draw and both teams get one points.
Input specification
You will be first given two numbers; the number of teams (n) and the number of matches played (m)
where 2 ≤ n ≤ 20 and 1 ≤ m ≤ 200. The following n lines give the team names, and then
the following m lines list the played matches.
Output specification
Show all teams in descending order according to their points.
If two teams have the same points show them according team names (in increasing order).
Sample Input I
8 6
Besiktas
Bursaspor
Eskisehirspor
Fenerbahce
Galatasaray
Gaziantepspor
Genclerbirligi
Trabzonspor
Galatasaray Fenerbahce 3 2
Trabzonspor Besiktas 2 2
Bursaspor Genclerbirligi 0 0
Eskisehirspor Gaziantepspor 2 3
Galatasaray Trabzonspor 1 0
Fenerbahce Besiktas 1 0
|
Sample Input II
6 6
Besiktas
Konyaspor
Karabukspor
Fenerbahce
Galatasaray
Sivasspor
Besiktas Konyaspor 3 1
Karabukspor Fenerbahce 2 2
Galatasaray Sivasspor 3 0
Besiktas Karabukspor 2 3
Konyaspor Sivasspor 2 2
Fenerbahce Galatasaray 0 1
|
Sample Output I
Galatasaray 6
Fenerbahce 3
Gaziantepspor 3
Besiktas 1
Bursaspor 1
Genclerbirligi 1
Trabzonspor 1
Eskisehirspor 0
|
Sample Output II
Galatasaray 6
Karabukspor 4
Besiktas 3
Fenerbahce 1
Konyaspor 1
Sivasspor 1
|
Для отправки решений необходимо выполнить вход.
|