結果

問題 No.239 にゃんぱすー
ユーザー ajiruajiru
提出日時 2020-02-05 08:40:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 71,588 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 03:18:25
合計ジャッジ時間 1,976 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	vector<int> candidates(n, 1);
	string s;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cin >> s;
			if (s != "nyanpass" && s != "-")
				candidates[j] = 0;
		}
	}
	int id = 0;
	for (int i = 0; i < n; ++i)
		if (candidates[i] == 1) id = i + 1;
	int renchon = count(candidates.begin(), candidates.end(), 1);
	if (renchon == 1) cout << id << endl;
	else cout << -1 << endl;
	return 0;
}
0