結果

問題 No.239 にゃんぱすー
ユーザー focus
提出日時 2018-01-22 01:38:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 676 bytes
コンパイル時間 840 ms
コンパイル使用メモリ 60,896 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 22:01:44
合計ジャッジ時間 2,716 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int N,count=0,ans;
    string s[100][100];
    bool flag;
    cin >> N;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin >> s[i][j];
        }
    }
    for(int j=0;j<N;j++){
        if(s[0][j]=="nyanpass"||s[0][j]=="-"){
            flag=1;
            for(int i=1;i<N;i++){
                if(i!=j&&s[i][j]!="nyanpass")   flag=0;
            }
            if(flag){
                ans = j;
                count++;
            }
        }
    }
    if(count==1)    cout << ++ans;
    else    cout << "-1";
    return 0;
}

0