結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー forest3
提出日時 2020-03-19 12:59:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 303 bytes
コンパイル時間 1,616 ms
コンパイル使用メモリ 174,252 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-14 03:07:29
合計ジャッジ時間 2,952 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:24:17: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   24 |         cout << ans << endl;
      |                 ^~~
main.cpp:15:13: note: 'ans' was declared here
   15 |         int ans;
      |             ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	cin >> N;
	map<int, int> mp;
	for( int i = 0; i < N; i++ ) {
		int L;
		cin >> L;
		mp[L]++;
	}

	int ans;
	int ma= 0;
	for( auto e : mp ) {
		if( e.second >= ma ) {
			ma = e.second;
			ans = e.first;
		}
	}

	cout << ans << endl;
}
0