結果

問題 No.706 多眼生物の調査
ユーザー stmtk_01stmtk_01
提出日時 2018-07-20 15:53:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 795 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 65,724 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 00:16:19
合計ジャッジ時間 1,509 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

int main(){
    int n;
    cin >> n;
    vector<int> s(n);
    int max_ = 0;
    repi(i, s){
        string a;
        cin >> a;
        *i = a.size() - 2;
        max_ = max(max_, *i);
    }
    vector<int> num(max_ + 1, 0);
     repi(i, s){
         num[*i]++;
    }
     int ans = 0, count_ = 0;
     rep(i, num.size()){
         if(count_ <= num[i]){
             ans = i;
             count_ = num[i];
         }
     }
     cout << ans << endl;
    return 0;
}
0