結果

問題 No.239 にゃんぱすー
ユーザー hogeover30
提出日時 2016-05-18 23:21:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 731 ms
コンパイル使用メモリ 74,348 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 01:02:33
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
    int n; cin>>n;
    vector<vector<string>> a(n);
    for(auto& e: a) {
        vector<string> v(n);
        for(auto& s: v) cin>>s;
        e=v;
    }

    int res=-1;
    for(int j=0; j<n; ++j) {
        int cnt=0;
        for(int i=0; i<n; ++i) if (a[i][j]=="nyanpass") ++cnt;
        if (cnt==n-1) {
            if (res==-1) {
                res=j+1;
            }
            else {
                cout<<-1<<endl;
                return 0;
            }
        }
    }
    cout<<res<<endl;
}
0