結果

問題 No.239 にゃんぱすー
ユーザー sorag
提出日時 2022-08-18 15:06:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 824 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 06:07:24
合計ジャッジ時間 1,889 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<utility>
#include <vector>
#include <map>
#include<string>
#include<set>
#include<queue>
#include<math.h>
#define pb push_back
#define all(x) begin(x),end(x)
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    int n;
    cin>>n;
    int count{0},res{0};
    vector<int> c(n);
    vector<vector<string>> a(n,vector<string>(n));
    string s="nyanpass";
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
    }
}
    for(int i=0;i<n;i++){
        int f=0;
        for(int j=0;j<n;j++){
            if(a[j][i]==s) f++;
            }
        if(f==n-1) {
            count++;
            if(count==1) res=i;
        }
    }

    if(count==1) cout<<res+1<<endl;
    else cout<<-1<<endl;
    return 0;
}
  
    

0