結果

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

ソースコード

diff #

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

int main(){
	int n;
	cin >> n;
	vector<string> data(n*n);
	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;
				}
			}
		}
	}
	cout << check << endl;
	return 0;
}
0