結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
![]() |
提出日時 | 2016-09-25 10:47:46 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 1,444 ms |
コンパイル使用メモリ | 77,688 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 11:31:23 |
合計ジャッジ時間 | 2,741 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 WA * 2 |
ソースコード
#include<stdio.h> #include <vector> #include <list> #include <map> #include <set> #include <queue> #include <stack> #include <algorithm> #include <sstream> #include <iostream> #include <string> #include <stdio.h> using namespace std; int main() { int N; string S[105][105]; cin >> N; for (int i = 0; i < N; i++) { for(int j = 0; j<N; j++) { cin >> S[i][j]; } } map<int, int> m; int M = -1; for (int j = 0; j<N; j++) { for (int i = 0; i < N; i++) { if (S[i][j] == "nyanpass") { m[j]++; M = max(M, m[j]); } } } int ans = -1; bool flag = false; map<int, int>::iterator it = m.begin(); while (it != m.end()) { if ((*it).second == M) { if (flag) { cout << -1 << endl; return 0; } else { ans = (*it).first + 1; flag = true; } } it++; } cout << ans << endl; return 0; }