結果

問題 No.239 にゃんぱすー
ユーザー zaichu
提出日時 2015-12-16 14:25:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 887 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 62,508 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-16 05:40:38
合計ジャッジ時間 1,521 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> data;
	data.resize(n,0);
	int check = -1;
	/*
	for(auto &a:data){
		cin >> a;
	}
	for(int i = 0; i < n+1; i++){
		if(i % (n+1) == 0) continue;
		if(data[i] == "nyanpass"){
			int count = 1;
			for(int j = i + n; j < n * n; j += n){
				if(data[j] == "nyanpass") count++;
				if(count == n - 1){
					(check == -1) ? (check = (i%n)+1) : (check = -2);
				}
				if(check == -2){
					check = -1;
					break;
				}
			}
		}
	}
	*/

	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") data[j] = 1;
			else data[j] = 0;
		}
	}
	int count = 0;
	for(int j = 0; j < n; j++){
		if(data[j]==1){
			count++;
			check = j + 1;
		}
	}
	if( count != 1 ) check = -1;
	cout << check << endl;
	return 0;
}
0