結果

問題 No.706 多眼生物の調査
ユーザー chacoder1
提出日時 2021-01-10 10:42:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 2,471 ms
コンパイル使用メモリ 198,532 KB
最終ジャッジ日時 2025-01-17 15:53:53
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int n;
  cin>>n;
  map<int,int>mp;
  string s;
  for(int i=0;i<n;i++){
    cin>>s;
    mp[s.length()]++;
  }
  int maxdata=0;
  int ans=0;
  for(auto e:mp){
    if(maxdata<e.second){
      maxdata=e.second;
      ans=e.first-2;
    }
    if(maxdata==e.second){
      if(ans<e.first-2){
        ans=e.first-2;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}
0