結果

問題 No.239 にゃんぱすー
ユーザー Y_S
提出日時 2020-08-25 21:25:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 757 bytes
コンパイル時間 800 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 11:43:03
合計ジャッジ時間 2,169 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil

using namespace std;

int main() {

	int N;
	cin >> N;

	vector<int> A(N);
	string temp;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> temp;
			if (temp == "nyanpass") {
				A[j]++;
			}
		}
	}

	if (count(A.begin(), A.end(), N - 1) == 1) {
		int max_index = distance(A.begin(), max_element(A.begin(), A.end()));
		cout << max_index + 1 << endl;
	}
	else {
		cout << -1 << endl;
	}

	return 0;

}
0