結果

問題 No.79 過小評価ダメ・ゼッタイ
コンテスト
ユーザー Rumain831
提出日時 2026-08-11 02:23:12
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.90.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 10 ms / 5,000 ms
+ 19µs
コード長 335 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,312 ms
コンパイル使用メモリ 170,928 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-11 02:23:27
合計ジャッジ時間 5,182 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   20 |   cout << ans << endl;
      |           ^~~
main.cpp:14:14: note: 'ans' was declared here
   14 |   int mx=-1, ans;
      |              ^~~

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

int cnt[7];
int main(void){
  int n; cin >> n;
  while(n--){
    int l; cin >> l;
    cnt[l]++;
  }
  int mx=-1, ans;
  for(int i=1; i<7; i++){
    if(mx<=cnt[i]){
      mx=cnt[i], ans=i;
    }
  }
  cout << ans << endl;
  return 0; 
}
0