結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー ninoinui
提出日時 2020-01-15 03:38:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 303 bytes
コンパイル時間 1,984 ms
コンパイル使用メモリ 173,900 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 18:44:34
合計ジャッジ時間 3,374 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  map<int, int> M;
  int vote = 0, ans = 0;
  for (int i = 0, L; i < N && cin >> L; i++) {
    M[L]++;
    if (M[L] > vote) vote = M[L], ans = L;
    else if (M[L] == vote && L > ans) ans = L; 
  }
  cout << ans << "\n";
}
0