結果
問題 |
No.79 過小評価ダメ・ゼッタイ
|
ユーザー |
|
提出日時 | 2023-11-25 08:42:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 3,140 ms |
コンパイル使用メモリ | 249,212 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-26 10:12:24 |
合計ジャッジ時間 | 4,260 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N, L; cin >> N; map<int, int> c; while (N--) { cin >> L; c[L]++; } int max_cnt = 0, ans = -1; for (auto [i, j]: c) { if (j > max_cnt) { max_cnt = j; ans = i; } else if (j == max_cnt && i > ans) { ans = i; } } cout << ans << '\n'; }