結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
![]() |
提出日時 | 2015-08-21 15:55:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 731 bytes |
コンパイル時間 | 540 ms |
コンパイル使用メモリ | 63,296 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 11:17:04 |
合計ジャッジ時間 | 1,729 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 WA * 2 |
ソースコード
#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 || 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; }