結果
| 問題 | No.239 にゃんぱすー |
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2015-08-21 16:40:08 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| + 801µs | |
| コード長 | 752 bytes |
| 記録 | |
| コンパイル時間 | 328 ms |
| コンパイル使用メモリ | 82,120 KB |
| 実行使用メモリ | 9,396 KB |
| 最終ジャッジ日時 | 2026-08-17 00:46:40 |
| 合計ジャッジ時間 | 2,106 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
const std::string n = "nyanpass";
int main() {
int people;
std::cin >> people;
std::vector<int> nyanpas_count(people, 0);
for (int i = 0; i < people; i++) {
for (int j = 0; j < people; j++) {
std::string str;
std::cin >> str;
if (str == n){
nyanpas_count[j]++;
}
}
}
int max = *std::max_element(nyanpas_count.begin(), nyanpas_count.end());
if (max == 0 || max != people - 1 || std::count(nyanpas_count.begin(), nyanpas_count.end(), max) > 1) {
std::cout << -1 << std::endl;
} else {
for (size_t i = 0; i < nyanpas_count.size(); i++) {
if (nyanpas_count[i] == max) {
std::cout << i + 1 << std::endl;
break;
}
}
}
return 0;
}
hanorver