結果

問題 No.1285 ゴミ捨て
ユーザー leaf_1415leaf_1415
提出日時 2020-11-13 21:23:38
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 899 bytes
コンパイル時間 1,629 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 10,444 KB
最終ジャッジ日時 2023-08-19 07:09:20
合計ジャッジ時間 3,594 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 65 ms
10,152 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 26 ms
6,280 KB
testcase_10 AC 59 ms
9,340 KB
testcase_11 AC 62 ms
8,812 KB
testcase_12 AC 45 ms
7,296 KB
testcase_13 AC 43 ms
7,364 KB
testcase_14 AC 78 ms
9,876 KB
testcase_15 AC 49 ms
8,044 KB
testcase_16 AC 11 ms
4,636 KB
testcase_17 AC 11 ms
4,732 KB
testcase_18 AC 11 ms
4,540 KB
testcase_19 AC 25 ms
6,000 KB
testcase_20 AC 10 ms
4,428 KB
testcase_21 AC 15 ms
5,180 KB
testcase_22 AC 90 ms
10,444 KB
testcase_23 AC 88 ms
10,380 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