結果

問題 No.706 多眼生物の調査
ユーザー aaaaaa
提出日時 2018-07-17 14:08:25
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 1,072 bytes
コンパイル時間 1,327 ms
コンパイル使用メモリ 108,940 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-16 10:54:37
合計ジャッジ時間 1,990 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 3 ms
4,384 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 12 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0