結果

問題 No.1285 ゴミ捨て
ユーザー leaf_1415leaf_1415
提出日時 2020-11-13 21:23:38
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 899 bytes
コンパイル時間 850 ms
コンパイル使用メモリ 87,860 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2024-05-06 14:22:59
合計ジャッジ時間 2,371 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 55 ms
10,112 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 21 ms
6,272 KB
testcase_10 AC 46 ms
9,088 KB
testcase_11 AC 44 ms
8,704 KB
testcase_12 AC 32 ms
7,296 KB
testcase_13 AC 33 ms
7,168 KB
testcase_14 AC 54 ms
9,728 KB
testcase_15 AC 35 ms
7,808 KB
testcase_16 AC 9 ms
5,376 KB
testcase_17 AC 9 ms
5,376 KB
testcase_18 AC 9 ms
5,376 KB
testcase_19 AC 21 ms
6,016 KB
testcase_20 AC 8 ms
5,376 KB
testcase_21 AC 12 ms
5,376 KB
testcase_22 AC 60 ms
10,368 KB
testcase_23 AC 62 ms
10,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(),(x).end()
#define inf 1e18

using namespace std;

typedef long long llint;
typedef pair<llint, llint> P;

llint n;
llint a[100005];
map<llint, llint> mp;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	rep(i, 1, n) cin >> a[i], mp[a[i]]++;
	
	llint ans = 0;
	for(auto x : mp){
		llint tmp = x.second;
		if(mp.count(x.first+1)) tmp += mp[x.first+1];
		chmax(ans, tmp);
	}
	cout << ans << endl;
	
	return 0;
}
0