結果

問題 No.239 にゃんぱすー
ユーザー AkaridaPyon
提出日時 2021-05-24 20:04:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 69,436 KB
最終ジャッジ日時 2025-01-21 17:58:17
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {

	int n;
	cin >> n;

	string a[n][n];
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}

	int ans = -1;
	int renchon = 0;
	for(int j = 0; j < n; j++) {
		bool isRenchon = true;
		for(int i = 0; i < n; i++ ) {
			if(i == j) continue;
			if(a[i][j] != "nyanpass") {
				isRenchon = false;
			}
		}
		if(isRenchon) {
			renchon++;
			ans = j + 1;
		}
	}

	if(renchon != 1) ans = -1;
	cout << ans << endl;

	return 0;
}
0