G. MaratonIME does a competition

Codeforces
IDCF10137G
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
It's January and MaratonIME is attending to an ACM-ICPC Summer School in Campinas. Renzo, THE POWERFUL, went to visit his students and, as usual, brought chocolates from Peru. However, after a couple of parties, MaratonIME is growing a lot and Renzo doesn't have enough chocolates for everyone. There is enough chocolate for of the students. So, Renzo will reward the best contestants. As a great coach, Renzo wants MaratonIME to work as a team, so he divided the students in 4 teams, , , and . The team which solves more problems wins. If two teams manage to solve the same amount of problems, Renzo rewards the team with smaller lexicographical name (if and draw, gets the chocolates). In order to assign participants to teams, Renzo found out the amount n of contestants and gave each one of them a different integer from 1 to n. Having numbered the students, Renzo decided that the one with number 1 would go to team , the one with number 2 would go to team and so on. Formally: There are many students and Renzo is busy thinking about the next contest he's creating, so you were chosen to determine which team wins the big prize! You are given a vector a of size n where, for each index 1 ≤ i ≤ n, ai is the amount of problems solved by contestant i during the contest. The amount of problems solved by a team is the sum of the problems solved by it's contestants. The first line of input has an integer 4 ≤ n ≤ 105. The second line, n integers 0 ≤ ai ≤ 104. You should print one line with name of the team that gets the chocolates: , , or . ## Input The first line of input has an integer 4 ≤ n ≤ 105. The second line, n integers 0 ≤ ai ≤ 104. ## Output You should print one line with name of the team that gets the chocolates: , , or . [samples]
**Definitions** Let $ n \in \mathbb{Z} $, $ 4 \leq n \leq 10^5 $, be the number of contestants. Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of non-negative integers, where $ a_i $ is the number of problems solved by contestant $ i $. Contestants are assigned to teams cyclically: - Contestant $ i $ is assigned to team $ T(i) $, where: $$ T(i) = \begin{cases} \texttt{A} & \text{if } i \equiv 1 \pmod{4} \\ \texttt{B} & \text{if } i \equiv 2 \pmod{4} \\ \texttt{C} & \text{if } i \equiv 3 \pmod{4} \\ \texttt{D} & \text{if } i \equiv 0 \pmod{4} \end{cases} $$ Let $ S_X = \sum_{i: T(i) = X} a_i $ denote the total problems solved by team $ X \in \{\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}\} $. **Constraints** $ 0 \leq a_i \leq 10^4 $ for all $ i \in \{1, \dots, n\} $ **Objective** Find the team $ X \in \{\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}\} $ with maximum $ S_X $. In case of a tie in $ S_X $, choose the team with lexicographically smallest name.
API Response (JSON)
{
  "problem": {
    "name": "G. MaratonIME does a competition",
    "description": {
      "content": "It's January and MaratonIME is attending to an ACM-ICPC Summer School in Campinas. Renzo, THE POWERFUL, went to visit his students and, as usual, brought chocolates from Peru. However, after a couple ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10137G"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "It's January and MaratonIME is attending to an ACM-ICPC Summer School in Campinas. Renzo, THE POWERFUL, went to visit his students and, as usual, brought chocolates from Peru. However, after a couple ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $, $ 4 \\leq n \\leq 10^5 $, be the number of contestants.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of non-negative integers, where $ a_i $ is the numb...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments