結果

問題 No.706 多眼生物の調査
ユーザー kazuto-horikazuto-hori
提出日時 2018-09-02 21:49:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 1,315 bytes
コンパイル時間 1,206 ms
コンパイル使用メモリ 109,004 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-07-25 19:02:06
合計ジャッジ時間 2,025 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 11 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}
int lcm(int a,int b){if(a==0){return b;} return a/gcd(a,b)*b;}
int MOD; template<class T> void mod(T &n){MOD=n;}
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

vector<int> ve;
map<int,int> mp;

signed main(){
  int n;
  cin>>n;
  for(int i=0; i<n; i++){
    string s; cin>>s;
    ve.push_back(s.size()-2);
    mp[s.size()-2]++;
  }
  sort(ve.begin(), ve.end());
  ve.erase(unique(ve.begin(), ve.end()),ve.end());
  P ans; ans.second=-1;
  for(int i=0; i<ve.size(); i++){
    if(ans.second<=mp[ve[i]]){ans.first=ve[i]; ans.second=mp[ve[i]];}
  }
  cout<<ans.first<<en;
}


0