結果

問題 No.239 にゃんぱすー
ユーザー tetsuzuki1115
提出日時 2017-09-26 19:53:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 952 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 87,624 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-15 16:51:36
合計ジャッジ時間 1,743 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;
    
    vector< vector<string> > V(N);
    
    for ( int i = 0; i < N; i++ ) {
    for ( int j = 0; j < N; j++ ) {
        string s;
        cin >> s;
        V[i].push_back(s);
    }
    }
    
    vector<int> renchons;
    for ( int i = 0; i < N; i++ ) {
        bool renchon = true;
        for ( int j = 0; j < N; j++ ) {
            if ( V[j][i] != "nyanpass" && V[j][i] != "-" ) { renchon = false; }
        }
        if ( renchon ) { renchons.push_back(i+1); }
    }
    
    if ( renchons.size() >= 2 || !renchons.size() ) { cout << -1 << endl; }
    else { cout << renchons[0] << endl; }
    
    return 0;
}
0