Logo
(追記) (追記ここまで)

33241번 - Ducks and Sharks 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB111432930.851%

문제

The Ducks and the Sharks have had many adventures in the past year. Because the weather has been so nice lately, they want to organise a water polo tournament. After forming the teams, every team plays one match against every other team. Being caught up in the fun of playing the matches, they don't feel like figuring out who won, so they turn to you for help.

You receive a list of matches and the number of goals made by both teams in a match. For each match, the winner gets 3 points, the loser gets 0 points, and in case of a draw both teams get 1 point. It is your job to figure out which teams got the most points, and provide a top five of the best teams.

입력

  • One line with one integer: 2ドル \leq n \leq 400,ドル the number of teams.
  • $\frac{n \cdot (n - 1)}2$ lines (one for each match), containing the names of the two teams and the number of goals both teams made during that match (all separated by one space).
    • The name of each team consists of at most 20 characters from the English alphabet (A-Z and a-z).
    • The scores are between 0ドル$ and 100ドル$ (inclusive).

Note that every team plays exactly once against every other team.

출력

The names of the top five teams in the water polo competition, followed by their total obtained score. Each team name should be written on a separate line. Each team name and score should be separated by exactly one space. Note:

  • If there are less than five teams participating, simply list all participants (see example 1).
  • If there are two teams with the same score, order them alphabetically (see example 2).

제한

예제 입력 1

4
Splashers Sharks 4 2
Ducks Fins 5 2
Fins Splashers 3 5
Ducks Sharks 0 5
Splashers Ducks 8 1
Fins Sharks 1 1

예제 출력 1

Splashers 9
Sharks 4
Ducks 3
Fins 1

예제 입력 2

5
A B 5 3
C D 2 9
A E 0 0
C B 1 1
A C 2 5
B E 2 5
D A 1 6
C E 4 2
B D 0 2
E D 5 2

예제 출력 2

A 7
C 7
E 7
D 6
B 1

힌트

출처

University > Delft University of Technology > Freshmen Programming Contest 2020 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /