結果

問題 No.239 にゃんぱすー
ユーザー rniya
提出日時 2020-03-06 23:45:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 1,654 ms
コンパイル使用メモリ 168,640 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 10:01:36
合計ジャッジ時間 2,710 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> renchon(N,1);
    for (int i=0;i<N;++i){
        for (int j=0;j<N;++j){
            string greeting; cin >> greeting;
            if (i==j) continue;
            if (greeting!="nyanpass") renchon[j]=0;
        }
    }
    int ans=-1;
    for (int i=0;i<N;++i){
        if (renchon[i]){
            if (ans!=-1){
                cout << -1 << '\n';
                return 0;
            }
            ans=i+1;
        }
    }
    cout << ans << '\n';
}
0