No.79 過小評価ダメ・ゼッタイ
問題文最終更新日: 2026-06-25 19:53:26
English (AI translation)
Never Underestimate
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 59
(順位表)
の他の問題:
Problem Statement
On the competitive programming problem site yurucoder, a level is set for each problem.
The level of a problem is determined from a user survey according to the following rules.
- \(N\) users each rate the level of the problem as \(L_i\). \((1 \leq i \leq N)\)
- A majority vote is taken, and the level with the most responses from users becomes the level of the problem.
- If multiple levels received the most responses, the higher level is adopted.
Following these rules, find the level of the problem from the ratings given by the users.
Input
\(N\) \(L_1\) \(L_2\) \(\dots\) \(L_N\)
The \(1\)st line contains an integer \(N\) \((1 \leq N \leq 10^5)\), the number of users who respond to the survey.
The \(2\)nd line contains space-separated integers \(L_i\) \((1 \leq Li \leq 6)\), the level each user answered.
Output
Output the level of the problem obtained by the majority vote.
Sample
Sample 1
Input
5 2 1 2 3 2
Output
2
The level is \(2\), which received the most responses.
Sample 2
Input
5 1 2 3 3 1
Output
3
\(1\) and \(3\) have the same number of responses, so the level is the higher one, \(3\).
Sample 3
Input
10 5 3 5 6 3 6 2 3 5 6
Output
6
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
yoza