結果

問題 No.239 にゃんぱすー
ユーザー prog470
提出日時 2016-09-25 11:04:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 70,624 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 11:34:01
合計ジャッジ時間 1,781 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;

int main() {

	int N;
	string S[105][105];

	cin >> N;
	for (int i = 0; i < N; i++) {
		for(int j = 0; j<N; j++) {
			cin >> S[i][j];
		}
	}

	int ans = -1;
	bool flag = false;

	for (int j = 0; j < N; j++) {
		int cnt = 0;
		for (int i = 0; i < N; i++) {
			if (S[i][j] == "nyanpass") {
				cnt++;
			}
		}
		if (cnt == N - 1) {
			if (flag) {
				cout << -1 << endl;
				return 0;
			}
			else {
				ans = j + 1;
				flag = true;
			}
		}
	}

	cout << ans << endl;

	return 0;
}
0