結果

問題 No.239 にゃんぱすー
ユーザー alchemin
提出日時 2019-09-13 18:08:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 847 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 78,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 03:53:02
合計ジャッジ時間 2,389 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    vector<vector<string>> mat;
    
    cin >> n;
    
    string tmp;
    for (int i = 0; i < n; i++) {
        vector<string> v;
        mat.push_back(v);
        for (int j = 0; j < n; j++) {
            cin >> tmp;
            mat[i].push_back(tmp);
        }
    }
    
    vector<int> lenchon_like;
    for (int j = 0; j < n; j++) {
        int nyanpass_ct = 0;
        for (int i = 0; i < n; i++) {
            if(mat[i][j] == "nyanpass") {
                nyanpass_ct++;
            }
        }
            
        if (nyanpass_ct == n - 1) {
            lenchon_like.push_back(j + 1);
        }
    }
    
    if (lenchon_like.size() == 1) {
        cout << lenchon_like[0] << endl;
    } else {
        cout << -1 << endl;
    }
    
    return 0 ;
}
0