結果

問題 No.239 にゃんぱすー
ユーザー Shawn stayC
提出日時 2020-06-09 22:48:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 1,896 ms
コンパイル使用メモリ 166,252 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-03 02:11:22
合計ジャッジ時間 3,750 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
	int n; cin>>n;
	vector<vector<int>> v(n, vector<int>(n));
	
	rep(i,n){
		rep(j,n){
			string s; cin>>s;
			if(s=="-"||s=="nyanpass") v[i][j]=1;
		}
	}
	
	int cnt=0;
	vector<int> ans;
	rep(i,n){
		rep(j,n){
			if(v[j][i]==1) cnt++;
		}
		if(cnt==n) ans.push_back(i+1);
		cnt=0;
	}
	
	if(ans.size()!=1) cout << "-1" << endl;
	else cout << ans[0] << endl;
}
0