結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー d_seid_sei
提出日時 2019-08-28 08:07:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 844 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 85,820 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 20:35:52
合計ジャッジ時間 1,984 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 21 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 20 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 13 ms
5,376 KB
testcase_15 AC 7 ms
5,376 KB
testcase_16 AC 16 ms
5,376 KB
testcase_17 AC 6 ms
5,376 KB
testcase_18 AC 15 ms
5,376 KB
testcase_19 AC 12 ms
5,376 KB
testcase_20 AC 20 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 8 ms
5,376 KB
testcase_23 AC 19 ms
5,376 KB
testcase_24 AC 20 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long int lont;
int main() {
	int N;
	cin >> N;
	vector<int>veca(N+1);
	for (int ia = 0; ia < N; ia++) {
		cin >> veca.at(ia);
	}
	sort(veca.begin(), veca.end());
	reverse(veca.begin(), veca.end());
	int cnta = 1;
	int cntb = 0;
	vector<int>vecb(N);
	for (int ib = 0; ib < N; ib++) {
		if (veca.at(ib) == veca.at(ib + 1)) {
			cnta++;
		}
		else {
			vecb.at(cntb) = cnta;
			cnta = 1;
			cntb++;
		}
	}
	sort(vecb.begin(), vecb.end());
	reverse(vecb.begin(), vecb.end());
	int M = vecb.at(0);
	int cntc = 1;
	for (int id = 0; id < N; id++) {
		if (veca.at(id) == veca.at(id + 1)) {
			cntc++;
		}
		if(veca.at(id)!=veca.at(id+1)) {
			cntc = 1;
		}
		if (cntc == M) {
			cout << veca.at(id) << endl;
			break;
		}
	}
}
0