Submission #2166852


Source Code Expand

#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

ll n, a[100000 + 10], ans;

int main() {
	rd(n);
	repi(i, 0, n) {
		ll t;
		rd(t);
		if (t > 0) a[t - 1]++;
		a[t]++;
		a[t + 1]++;
	}
	repi(i, 0, 100000 + 10) {
		ans = max(ans, a[i]);
	}
	wrln(ans);
	return 0;
}

Submission Info

Submission Time
Task C - Together
User at_cacao_jp
Language C++14 (GCC 5.4.1)
Score 300
Code Size 796 Byte
Status AC
Exec Time 31 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 9
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt AC 17 ms 256 KB
1_005.txt AC 29 ms 256 KB
1_006.txt AC 31 ms 256 KB
1_007.txt AC 29 ms 256 KB
1_008.txt AC 29 ms 1024 KB