結果
| 問題 | No.79 過小評価ダメ・ゼッタイ |
| コンテスト | |
| ユーザー |
LV3zJigVW57oPGy
|
| 提出日時 | 2022-11-15 22:30:31 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 503 bytes |
| 記録 | |
| コンパイル時間 | 1,079 ms |
| コンパイル使用メモリ | 180,288 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-05 23:43:51 |
| 合計ジャッジ時間 | 2,368 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 14 WA * 8 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:5: warning: 'number' may be used uninitialized [-Wmaybe-uninitialized]
20 | if(number==b){
| ^~
main.cpp:12:7: note: 'number' was declared here
12 | int number, th;
| ^~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
from main.cpp:1:
In function 'const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]',
inlined from 'int main()' at main.cpp:21:13:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:263:7: warning: 'th' may be used uninitialized [-Wmaybe-uninitialized]
263 | if (__a < __b)
| ^~
main.cpp: In function 'int main()':
main.cpp:12:15: note: 'th' was declared here
12 | int number, th;
| ^~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string>
#include <algorithm>
int main(){
int a;
cin >> a;
int number, th;
vector<int> vec(a);
for(int i=0; i<a;i++){
cin >> vec.at(i);
}
sort(vec.begin(),vec.end());
for(int i=0; i<6;i++){
int b = count(vec.begin(),vec.end(),i);
if(number==b){
th = max(i,th);
}
else if(max(number,b)==b){
number = b;
th = i;
}
}
cout << th;
}
LV3zJigVW57oPGy