結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー snrnsidy
提出日時 2021-06-10 04:32:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 383 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 192,436 KB
最終ジャッジ日時 2025-01-22 05:14:32
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int arr[7];
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int res = 0;
	int cnt = 0;
	int n, t;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> t;
		arr[t]++;
		if (cnt < arr[t])
		{
			cnt = arr[t];
			res = t;
		}
		else if (cnt == arr[t])
		{
			res = max(res, t);
		}
	}

	cout << res << '\n';
	
	return 0;
}
0