結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー Shawn stayCShawn stayC
提出日時 2020-05-25 23:20:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 168,260 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-21 03:58:06
合計ジャッジ時間 2,733 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
	int n; cin>>n;
	vector<int> v(n);
	rep(i,n) cin>>v[i];
	sort(v.begin(), v.end(), greater<int>());
	int u=v[0];
	int pre=1; int cnt=1;
	for(int i=0; i<n-1; i++){
		if(v[i]==v[i+1]) cnt++;
		else{
			if(cnt>pre){
				u=v[i];
				pre=cnt;
				cnt=1;
			} else {
              u=v[i+1];
				cnt=1;
			}
		}
	}
	cout <<u<< endl;	
}
0