結果

問題 No.239 にゃんぱすー
ユーザー Mizuno
提出日時 2024-10-26 12:01:59
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 608 bytes
コンパイル時間 9,907 ms
コンパイル使用メモリ 96,144 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-26 12:02:17
合計ジャッジ時間 2,926 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main() {
	
	int n; cin >> n;
	vector<vector<string>> a(n,vector<string>(n,""));
	vector<int> arr(n,0);
	for(int i = 0; i < n; i++){
	    for(int j = 0; j < n; j++){
	        cin >> a[i][j];
	        if(a[i][j] == "nyanpass") arr[j] += 1;
	    }
	}
	bool f = false;
	
	for(int it:arr) {
		if(it == (n-1) && !f){
			f = true;
		} else if (it == (n-1) && f) {
			cout << -1;
			return 0;
		}
	}
	for(int i = 0; i < n; i++) {
	    if(arr[i] == (n-1)){
	        cout << i + 1;
	        return 0;
	    }
	}
	cout << -1;
	
	return 0;
}
0