結果

問題 No.239 にゃんぱすー
ユーザー hanorver
提出日時 2015-11-06 09:45:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 63,916 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-13 12:59:53
合計ジャッジ時間 1,713 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n;
    std::cin >> n;

    std::vector<int> v(n);
    for (size_t i = 0; i < n; i++) {
        for (size_t j = 0; j < n; j++) {
            std::string greet;
            std::cin >> greet;
            if(greet == "nyanpass") v[j]++;
        }
    }

    int max = *std::max_element(v.begin(), v.end());
    if(std::count(v.begin(), v.end(), max) != 1){
        std::cout << -1 << std::endl;
        return 0;
    }
    for (size_t i = 0; i < v.size(); i++) {
        if(v[i] == max){
            std::cout << i + 1 << std::endl;
            return 0;
        }
    }
    return 0;
}
0