HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


220. 50754 - Team Standings

Guest
• Review clarifications (1)

Volume problems

• Problem 3
• 50468 - Draw Matrix - 2
• 010. 50381 - Sum of the numbers
• 125. 50538 - Sum of kth Diagonal
• 140. 50599 - Sum of Squared Error ...
• 15-SprPrE1-80. 50741 - DNA Distance
• 155. 50334 - What is the class aver...
• 185. 50784 - Top Growing Company
• 220. 50754 - Team Standings
• 230. 50286 - Remove Duplicates
• 250. 50448 - Paint Buckets
• 280. 50477 - Character Pyramids
• 50304 - Number Pattern
• 50492 - Contest Scoreboard
• 50322 - Snake Pattern
• 50321 - Missing Number
• 50445 - Cryptography

Feedback

If you notice incorrect translations in Contester, please let author know.

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


Для отправки решений необходимо выполнить вход.

www.contester.ru