| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 10 | 9 | 9 | 90.000% |
The Premier League is the highest level of football (soccer, if you must!) in England and is widely considered the best football league in the world. Most football leagues around the world, including the Premier League, use a point system to determine who wins the league trophy.
Each team receives 3ドル$ points for winning a game, 1ドル$ point for drawing (tie), and 0ドル$ for losing. After 38ドル$ games (also called "fixtures") in a season spanning from August to May, the winner of the league is the team with the most points.
However, if points are tied, it goes to whichever team has the best goal differential (GD) calculated by taking the goals scored (called GF, goals for) minus goals let in (called GA, goals against). Note that goal differential can be a negative number. If neither points nor GD can break the tie, the teams are sorted alphabetically.1
The Premier League needs your help! The company they hired couldn't figure out how to make the table, so they hired you to create a sorted Premier League table based off of the results of all matches from a season.
1No, they don't use this as the actual tie-breaker
The first line of input will be $N,ドル the number of fixtures to follow. The next $N$ lines will be the scores of each fixture throughout a season in the following format:
Team_One X-Y Team_Two
where Team_One is the first team and X is their score for that fixture and Team_Two is the second team and Y is their score for that fixture. Both X and Y are guaranteed to be non-negative numbers.
Input Restrictions
2Yes, a million goals scored in one game is physically impossible.
The output is a sorted league table with each line representing data from a single team. The data on each line should be space-separated, and should be as follows:
Team name, how many games the team has played (MP), number of wins, number of draws, number of losses, goals for (GF), goals against (GA), goal differential (GD), and points (PTS).
Each team is uniquely identified by their name in the input; there will be no duplicate team names.
Sorting priority (from highest to lowest) is points $\rightarrow$ GD $\rightarrow$ alphabetical. For instance, if two teams both have 70ドル$ points, then the team with the higher GD will appear earlier in the table. If two teams have both the same number of points and the same GD, then the team whose name comes first alphabetically will appear earlier in the table.
2 Manchester_City 1-3 Liverpool Leicester_City 2-1 Manchester_United
Liverpool 1 1 0 0 3 1 2 3 Leicester_City 1 1 0 0 2 1 1 3 Manchester_United 1 0 0 1 1 2 -1 0 Manchester_City 1 0 0 1 1 3 -2 0
4 Watford 4-1 Wolves Aston_Villa 3-1 Burnley Watford 4-2 Leeds_United Crystal_Palace 2-4 Aston_Villa
Watford 2 2 0 0 8 3 5 6 Aston_Villa 2 2 0 0 7 3 4 6 Burnley 1 0 0 1 1 3 -2 0 Crystal_Palace 1 0 0 1 2 4 -2 0 Leeds_United 1 0 0 1 2 4 -2 0 Wolves 1 0 0 1 1 4 -3 0
School > CS@Mines > CS@Mines HSPC 2022 > Beginner K번
School > CS@Mines > CS@Mines HSPC 2022 > Advanced H번