A. Room Leader

Codeforces
IDCF74A
Time2000ms
Memory256MB
Difficulty
implementation
English · Original
Chinese · Translation
Formal · Original
Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document. In the beginning of the round the contestants are divided into rooms. Each room contains exactly _n_ participants. During the contest the participants are suggested to solve five problems, _A_, _B_, _C_, _D_ and _E_. For each of these problem, depending on when the given problem was solved and whether it was solved at all, the participants receive some points. Besides, a contestant can perform hacks on other contestants. For each successful hack a contestant earns 100 points, for each unsuccessful hack a contestant loses 50 points. The number of points for every contestant is represented by the sum of points he has received from all his problems, including hacks. You are suggested to determine the leader for some room; the leader is a participant who has maximum points. ## Input The first line contains an integer _n_, which is the number of contestants in the room (1 ≤ _n_ ≤ 50). The next _n_ lines contain the participants of a given room. The _i_\-th line has the format of "_handle__i_ _plus__i_ _minus__i_ _a__i_ _b__i_ _c__i_ _d__i_ _e__i_" — it is the handle of a contestant, the number of successful hacks, the number of unsuccessful hacks and the number of points he has received from problems _A_, _B_, _C_, _D_, _E_ correspondingly. The handle of each participant consists of Latin letters, digits and underscores and has the length from 1 to 20 characters. There are the following limitations imposed upon the numbers: * 0 ≤ _plus__i_, _minus__i_ ≤ 50; * 150 ≤ _a__i_ ≤ 500 or _a__i_ = 0, if problem _A_ is not solved; * 300 ≤ _b__i_ ≤ 1000 or _b__i_ = 0, if problem _B_ is not solved; * 450 ≤ _c__i_ ≤ 1500 or _c__i_ = 0, if problem _C_ is not solved; * 600 ≤ _d__i_ ≤ 2000 or _d__i_ = 0, if problem _D_ is not solved; * 750 ≤ _e__i_ ≤ 2500 or _e__i_ = 0, if problem _E_ is not solved. All the numbers are integer. All the participants have different handles. It is guaranteed that there is exactly one leader in the room (i.e. there are no two participants with the maximal number of points). ## Output Print on the single line the handle of the room leader. [samples] ## Note The number of points that each participant from the example earns, are as follows: * _Petr_ — 3860 * _tourist_ — 4140 * _Egor_ — 4030 * _c00lH4x0R_ —  - 350 * _some_participant_ — 2220 Thus, the leader of the room is _tourist_.
让我们回顾一下 Codeforces 的部分规则。以下规则已简化,以本题题面为正式文档。 比赛开始时,参赛者被分配到不同的房间。每个房间恰好包含 #cf_span[n] 名参赛者。比赛期间,参赛者需解决五道题目:#cf_span[A]、#cf_span[B]、#cf_span[C]、#cf_span[D] 和 #cf_span[E]。对于每道题目,参赛者根据解题时间及是否解出,获得相应分数。此外,参赛者可以对其他参赛者进行 Hack。每次成功 Hack 可获得 #cf_span[100] 分,每次失败 Hack 会扣掉 #cf_span[50] 分。每位参赛者的总分等于其从所有题目(包括 Hack)中获得的分数之和。 你需要确定某个房间的领先者;领先者是分数最高的参赛者。 第一行包含一个整数 #cf_span[n],表示房间中的参赛者人数(#cf_span[1 ≤ n ≤ 50])。接下来的 #cf_span[n] 行描述了该房间的参赛者。第 #cf_span[i] 行的格式为 "#cf_span[handlei] #cf_span[plusi] #cf_span[minusi] #cf_span[ai] #cf_span[bi] #cf_span[ci] #cf_span[di] #cf_span[ei]",分别表示参赛者的用户名、成功 Hack 数量、失败 Hack 数量,以及其从题目 #cf_span[A]、#cf_span[B]、#cf_span[C]、#cf_span[D]、#cf_span[E] 获得的分数。每个参赛者的用户名由拉丁字母、数字和下划线组成,长度在 #cf_span[1] 到 #cf_span[20] 个字符之间。对数字的限制如下: 所有数字均为整数。所有参赛者的用户名互不相同。保证房间中恰好存在一位领先者(即不存在两名参赛者拥有相同的最高分)。 请在一行中输出该房间领先者的用户名。 示例中每位参赛者获得的分数如下: 因此,房间的领先者是 _tourist_。 ## Input 第一行包含一个整数 #cf_span[n],表示房间中的参赛者人数(#cf_span[1 ≤ n ≤ 50])。接下来的 #cf_span[n] 行描述了该房间的参赛者。第 #cf_span[i] 行的格式为 "#cf_span[handlei] #cf_span[plusi] #cf_span[minusi] #cf_span[ai] #cf_span[bi] #cf_span[ci] #cf_span[di] #cf_span[ei]",分别表示参赛者的用户名、成功 Hack 数量、失败 Hack 数量,以及其从题目 #cf_span[A]、#cf_span[B]、#cf_span[C]、#cf_span[D]、#cf_span[E] 获得的分数。每个参赛者的用户名由拉丁字母、数字和下划线组成,长度在 #cf_span[1] 到 #cf_span[20] 个字符之间。对数字的限制如下: #cf_span[0 ≤ plusi, minusi ≤ 50]; #cf_span[150 ≤ ai ≤ 500] 或 #cf_span[ai = 0](若题目 #cf_span[A] 未解出); #cf_span[300 ≤ bi ≤ 1000] 或 #cf_span[bi = 0](若题目 #cf_span[B] 未解出); #cf_span[450 ≤ ci ≤ 1500] 或 #cf_span[ci = 0](若题目 #cf_span[C] 未解出); #cf_span[600 ≤ di ≤ 2000] 或 #cf_span[di = 0](若题目 #cf_span[D] 未解出); #cf_span[750 ≤ ei ≤ 2500] 或 #cf_span[ei = 0](若题目 #cf_span[E] 未解出)。所有数字均为整数。所有参赛者的用户名互不相同。保证房间中恰好存在一位领先者(即不存在两名参赛者拥有相同的最高分)。 ## Output 请在一行中输出该房间领先者的用户名。 [samples] ## Note 示例中每位参赛者获得的分数如下: _Petr_ — #cf_span[3860] _tourist_ — #cf_span[4140] _Egor_ — #cf_span[4030] _c00lH4x0R_ — #cf_span[ - 350] _some_participant_ — #cf_span[2220] 因此,房间的领先者是 _tourist_。
**Definitions** Let $ n \in \mathbb{Z} $ be the number of contestants in the room. Let $ P = \{ (h_i, p_i, m_i, a_i, b_i, c_i, d_i, e_i) \mid i \in \{1, \dots, n\} \} $ be the set of contestant profiles, where for each contestant $ i $: - $ h_i \in \mathcal{H} $ is the handle (a string of length 1 to 20 over Latin letters, digits, and underscores), - $ p_i \in \mathbb{Z}_{\geq 0} $ is the number of successful hacks, - $ m_i \in \mathbb{Z}_{\geq 0} $ is the number of unsuccessful hacks, - $ a_i, b_i, c_i, d_i, e_i \in \mathbb{Z}_{\geq 0} $ are the points earned from problems A, B, C, D, E respectively. **Constraints** 1. $ 1 \leq n \leq 50 $ 2. $ p_i, m_i \geq 0 $ for all $ i $ 3. $ a_i, b_i, c_i, d_i, e_i \geq 0 $ for all $ i $ 4. All handles $ h_i $ are distinct. 5. There exists a unique contestant with maximum total score. **Objective** For each contestant $ i $, compute the total score: $$ s_i = p_i \cdot 100 - m_i \cdot 50 + a_i + b_i + c_i + d_i + e_i $$ Find the unique contestant $ i^* $ such that: $$ s_{i^*} = \max_{i \in \{1, \dots, n\}} s_i $$ Output $ h_{i^*} $.
Samples
Input #1
5
Petr 3 1 490 920 1000 1200 0
tourist 2 0 490 950 1100 1400 0
Egor 7 0 480 900 950 0 1000
c00lH4x0R 0 10 150 0 0 0 0
some_participant 2 1 450 720 900 0 0
Output #1
tourist
API Response (JSON)
{
  "problem": {
    "name": "A. Room Leader",
    "description": {
      "content": "Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document. In the beginning of the round the contestants are divided into ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF74A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document.\n\nIn the beginning of the round the contestants are divided into ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "让我们回顾一下 Codeforces 的部分规则。以下规则已简化,以本题题面为正式文档。\n\n比赛开始时,参赛者被分配到不同的房间。每个房间恰好包含 #cf_span[n] 名参赛者。比赛期间,参赛者需解决五道题目:#cf_span[A]、#cf_span[B]、#cf_span[C]、#cf_span[D] 和 #cf_span[E]。对于每道题目,参赛者根据解题时间及是否解出,获得相应分数。此外...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of contestants in the room.  \nLet $ P = \\{ (h_i, p_i, m_i, a_i, b_i, c_i, d_i, e_i) \\mid i \\in \\{1, \\dots, n\\} \\} $ be the set of contestant pr...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments