結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー LV3zJigVW57oPGyLV3zJigVW57oPGy
提出日時 2022-11-15 22:30:31
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 3,999 ms
コンパイル使用メモリ 147,892 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-15 03:41:20
合計ジャッジ時間 3,939 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 19 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 WA -
testcase_05 AC 18 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,352 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,352 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 12 ms
4,352 KB
testcase_15 WA -
testcase_16 AC 15 ms
4,348 KB
testcase_17 AC 6 ms
4,348 KB
testcase_18 AC 14 ms
4,352 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 8 ms
4,348 KB
testcase_23 AC 18 ms
4,356 KB
testcase_24 AC 19 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:15: warning: ‘th’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   int number, th;
               ^~

ソースコード

diff #

#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;
}
0