結果

問題 No.239 にゃんぱすー
ユーザー izryt(趣味)izryt(趣味)
提出日時 2016-01-16 12:09:08
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 1,298 ms
コンパイル使用メモリ 160,800 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 19:55:40
合計ジャッジ時間 2,480 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

string inp[100][100];

int main()
{
    int n;cin>>n;
    int renge;
    bool found = false;
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) {
        cin >> inp[i][j];
    }
    for (int i = 0; i < n; ++i) {
        int cnt = 0;
        for (int j = 0; j < n; ++j) {
            if (inp[j][i] == "nyanpass") cnt++;
        }
        if (cnt==n-1) {
            if (found) {
                cout << -1 << endl;
                return 0;
            }
            found = true;
            renge = i + 1;
        }
    }

    cout << (found ? renge : -1) << endl;
}
0