CF19A.World Football Cup

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:

  • the final tournament features n teams (n is always even)
  • the first n / 2 teams (according to the standings) come through to the knockout stage
  • the standings are made on the following principle: for a victory a team gets 3 points, for a draw — 1 point, for a defeat — 0 points. In the first place, teams are ordered in the standings in decreasing order of their points; in the second place — in decreasing order of the difference between scored and missed goals; in the third place — in the decreasing order of scored goals
  • it's written in Berland's Constitution that the previous regulation helps to order the teams without ambiguity.

You are asked to write a program that, by the given list of the competing teams and the results of all the matches, will find the list of teams that managed to get through to the knockout stage.

所有人都知道,2010 年国际足联世界杯正在南非举行。根据贝兰足球协会(BFA)的决定,下一届世界杯将在贝兰举行。BFA 决定对世界杯部分规则进行修改:

  • 决赛阶段共有 nn 支参赛队(nn 恒为偶数);
  • 根据最终排名,前 n/2n/2 支队伍晋级淘汰赛阶段;
  • 排名规则如下:胜一场得 3 分,平一场得 1 分,负一场得 0 分;首先按积分从高到低排序;积分相同时,按净胜球数(进球数减失球数)从高到低排序;净胜球数仍相同时,按总进球数从高到低排序;
  • 贝兰宪法中明确规定:上述规则可确保球队排名无歧义。

你需要编写一个程序,根据给定的参赛队列表以及所有比赛结果,输出成功晋级淘汰赛阶段的球队名单。

输入格式

The first input line contains the only integer n (1 ≤ n ≤ 50) — amount of the teams, taking part in the final tournament of World Cup. The following n lines contain the names of these teams, a name is a string of lower-case and upper-case Latin letters, its length doesn't exceed 30 characters. The following n·(n - 1) / 2 lines describe the held matches in the format name1-name2 num1:num2, where _name_1, _name_2 — names of the teams; _num_1, _num_2 (0 ≤ _num_1, _num_2 ≤ 100) — amount of the goals, scored by the corresponding teams. Accuracy of the descriptions is guaranteed: there are no two team names coinciding accurate to the letters' case; there is no match, where a team plays with itself; each match is met in the descriptions only once.

第一行输入包含一个整数 nn(1≤n≤501 \leq n \leq 50),表示参加世界杯决赛阶段比赛的球队数量。接下来的 nn 行每行包含一支球队的名称,名称由大小写拉丁字母组成,长度不超过 30 个字符。随后的 n⋅(n−1)/2n \cdot (n - 1) / 2 行描述了已进行的比赛,格式为 name1-name2 num1:num2,其中 name1、name2 为球队名称;num1、num2(0≤num1,num2≤1000 \leq \text{num1}, \text{num2} \leq 100)分别为对应球队的进球数。输入保证数据准确:不存在仅大小写不同的重复队名;不存在球队与自身比赛的情况;每场比赛在输入中恰好出现一次。

输出格式

Output n / 2 lines — names of the teams, which managed to get through to the knockout stage in lexicographical order. Output each name in a separate line. No odd characters (including spaces) are allowed. It's guaranteed that the described regulations help to order the teams without ambiguity.

输出 n/2n/2 行——成功晋级淘汰赛阶段的球队名称,按字典序排列。每行输出一个名称。不允许出现任何奇数字符(包括空格)。题目保证,根据所述规则可无歧义地对球队进行排序。

输入输出样例

  • 输入#1

    4
    A
    B
    C
    D
    A-B 1:1
    A-C 2:2
    A-D 1:0
    B-C 1:0
    B-D 0:3
    C-D 0:3

    输出#1

    A
    D
  • 输入#2

    2
    a
    A
    a-A 2:1

    输出#2

    a

输入解题思路,AI测评打分。不知道怎么写?

首页