結果

問題 No.239 にゃんぱすー
ユーザー hamray
提出日時 2017-11-19 20:20:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 690 bytes
コンパイル時間 1,116 ms
コンパイル使用メモリ 158,972 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 00:36:15
合計ジャッジ時間 2,074 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 16 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    int N; cin >> N;
    string nyan[N][N];
    int cnt = 0; 
    int key1, key2, key3;
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            cin >> nyan[i][j];
            if(nyan[i][j] == "nyanpass"){
                cnt++;
                if(i == 0) key1 = j+1;
                if(i == 1) key2 = j+1;
                if(i == 2) key3 = j+1;
            }
        }
    }
    if(cnt != N) {
        cout << -1 << endl;
    }else{
        if((key1 == key2) || (key3 == key2)){
            cout << key2 << endl;
        }else if((key1 == key3)){
            cout << key1 << endl;
        }
    }
    
    return 0;
}
0