CF24B.F1 Champions

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Formula One championship consists of series of races called Grand Prix. After every race drivers receive points according to their final position. Only the top 10 drivers receive points in the following order 25, 18, 15, 12, 10, 8, 6, 4, 2, 1. At the conclusion of the championship the driver with most points is the champion. If there is a tie, champion is the one with most wins (i.e. first places). If a tie still exists, it is chosen the one with most second places, and so on, until there are no more place to use for compare.

Last year another scoring system was proposed but rejected. In it the champion is the one with most wins. If there is tie, champion is the one with most points. If a tie still exists it is proceeded the same way as in the original scoring system, that is comparing number of second, third, forth, and so on, places.

You are given the result of all races during the season and you are to determine the champion according to both scoring systems. It is guaranteed, that both systems will produce unique champion.

一级方程式锦标赛(Formula One championship)由一系列被称为“大奖赛”(Grand Prix)的比赛组成。每场比赛结束后,车手根据其最终名次获得相应积分。仅有前10名车手可获得积分,积分分配顺序为:25、18、15、12、10、8、6、4、2、1。赛季结束时,总积分最高的车手成为年度冠军。若出现积分相同的情况,则比较两者的冠军次数(即第1名次数);若冠军次数仍相同,则比较亚军次数(即第2名次数),依此类推,直至分出胜负。

去年曾提出另一种计分方案,但未被采纳。该方案中,年度冠军首先依据冠军次数(即第1名次数)决定;若冠军次数相同,则比较总积分;若总积分仍相同,则按原计分方案的方式继续比较:即依次比较第2名次数、第3名次数、第4名次数……以此类推,直至分出胜负。

现给出整个赛季所有比赛的结果,请分别依据上述两种计分系统确定年度冠军。题目保证:两种计分系统均会得出唯一的冠军。

输入格式

The first line contain integer t (1 ≤ t ≤ 20), where t is the number of races. After that all races are described one by one. Every race description start with an integer n (1 ≤ n ≤ 50) on a line of itself, where n is the number of clasified drivers in the given race. After that n lines follow with the classification for the race, each containing the name of a driver. The names of drivers are given in order from the first to the last place. The name of the driver consists of lowercase and uppercase English letters and has length at most 50 characters. Comparing of names should be case-sensetive.

第一行包含一个整数 tt(1≤t≤201 \leq t \leq 20),其中 tt 表示比赛场数。随后依次描述每场比赛。每场比赛的描述以一个整数 nn(1≤n≤501 \leq n \leq 50)开始,该整数独占一行,表示该场比赛中获得名次的车手人数。接下来是 nn 行,每行包含一位车手的姓名,按从第一名到最后一名的顺序给出。车手姓名由大小写英文字母组成,长度至多为 50 个字符。姓名比较区分大小写。

输出格式

Your output should contain exactly two line. On the first line is the name of the champion according to the original rule, and on the second line the name of the champion according to the alternative rule.

第一行是根据原始规则选出的冠军姓名,第二行是根据替代规则选出的冠军姓名。

输入输出样例

  • 输入#1

    3
    3
    Hamilton
    Vettel
    Webber
    2
    Webber
    Vettel
    2
    Hamilton
    Vettel

    输出#1

    Vettel
    Hamilton
  • 输入#2

    2
    7
    Prost
    Surtees
    Nakajima
    Schumacher
    Button
    DeLaRosa
    Buemi
    8
    Alonso
    Prost
    NinoFarina
    JimClark
    DeLaRosa
    Nakajima
    Patrese
    Surtees

    输出#2

    Prost
    Prost

说明/提示

It is not guaranteed that the same drivers participate in all races. For the championship consider every driver that has participated in at least one race. The total number of drivers during the whole season is not more then 50.

不能保证相同的车手参加所有比赛。对于锦标赛,需考虑至少参加过一场比赛的每位车手。整个赛季中车手的总人数不超过 50 人。

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

首页