結果

問題 No.239 にゃんぱすー
ユーザー surumeika1987
提出日時 2019-07-17 10:43:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 635 ms
コンパイル使用メモリ 72,164 KB
最終ジャッジ日時 2025-01-07 07:10:44
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int n_num;
    cin >> n_num;
    
    string input_str;
    vector<int> nyanpass_cnt(n_num, 0);
    
    for (int i = 0; i < n_num; i++) {
        for (int j = 0; j < n_num; j++) {
            cin >> input_str;
            if (input_str == "nyanpass") {
                nyanpass_cnt[j] += 1;
            }
        }
    }
    
    int ans = -1;
    bool is_find = false;
    
    for (int i = 0; i < n_num; i++) {
        if (nyanpass_cnt[i] == n_num - 1) {
            if (is_find) {
                ans = -1;
                break;
            } else {
                ans = i + 1;
                is_find = true;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}
0