結果

問題 No.239 にゃんぱすー
ユーザー KKT89
提出日時 2019-12-17 02:23:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 1,335 ms
コンパイル使用メモリ 79,264 KB
最終ジャッジ日時 2025-01-08 11:50:40
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >> n;
	int a[n];
	for(int i=0;i<n;i++){
		a[i]=1;
	}
	for(int i=0;i<n;i++){
	 	for(int j=0;j<n;j++){
	 		string s; cin >> s;
	 		if(i==j)continue;
	 		if(s!="nyanpass")a[j]=0;
	 	}
	}
	int ans=-2;
	for(int i=0;i<n;i++){
		if(a[i]){
			if(ans>=0){
				cout << -1 << endl;
				return 0;
			}
			else{
				ans=i;
			}
		}
	}
	cout << ans+1 << endl;
}
0