結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー chacoder1
提出日時 2020-11-22 20:29:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 420 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 199,600 KB
最終ジャッジ日時 2025-01-16 04:41:14
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 3
other RE * 9 TLE * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ‘n’ is used uninitialized [-Wuninitialized]
    6 |   int L[n];
      |          ^
main.cpp:5:7: note: ‘n’ declared here
    5 |   int n;
      |       ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  int L[n]; 
  cin>>n;
  map<int,int>mp;
  for(int i=0;i<n;i++){
    cin>>L[i];
    mp[L[i]]++;
  }
  int ans=0;
  int nummax=0;
  for(auto itr=mp.begin();itr != mp.end();itr++){
    //cout<<itr->first<<" "<<itr->second<<endl;
    if((itr->second)>=nummax){
      nummax=itr->second;
      ans=(itr->first);
    }
  }
  cout<<ans<<endl;
  return 0;
}

0