結果
| 問題 | No.79 過小評価ダメ・ゼッタイ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-11 02:23:12 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 5,000 ms |
| + 19µs | |
| コード長 | 335 bytes |
| 記録 | |
| コンパイル時間 | 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;
| ^~~
ソースコード
#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;
}