結果
問題 | No.706 多眼生物の調査 |
ユーザー |
![]() |
提出日時 | 2018-07-17 14:08:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 1,072 bytes |
コンパイル時間 | 1,115 ms |
コンパイル使用メモリ | 109,520 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-24 23:11:37 |
合計ジャッジ時間 | 1,800 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
#include <stdio.h> #include <algorithm> #include <iostream> #include <string> #include <vector> #include <functional> #include <map> #include <iomanip> #include <math.h> #include <stack> #include <queue> #include <bitset> #include <cstdlib> #include <tuple> #include <cctype> using namespace std; int main() { int i, j, k; int n; vector<int> me(1000, -1); vector<string>s(1000); map<int, int>mp; vector<int>num(1000, 0); cin >> n; for (i = 0; i < n; i++) { int cnt = 0; cin >> s[i]; for (j = 0; j < s[i].length(); j++) { if (s[i][j] == '^') { cnt++; } } if (mp.count(cnt) == 0) { mp.insert(pair<int,int>(cnt,1)); } else { mp[cnt]++; } } map<int, int>::iterator it; int maxn = 0; for (it = mp.begin(); it != mp.end(); it++) { maxn = max(maxn, (*it).second); } int cnt2 = 0; for (it = mp.begin(); it != mp.end(); it++) { if ((*it).second == maxn) { num[cnt2] = (*it).first; cnt2++; } } sort(num.begin(), num.end(), greater<int>()); cout << num[0] << endl; getchar(); getchar(); return 0; }