Submission #1557453


Source Code Expand

#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> vl;
typedef vector<vector<long long> > vll;
typedef vector<P> vp;
typedef vector<vector<P> > vpp;

int main() {
	int n;
	cin>>n;
	vl a(n);
	REP(i,n) cin>>a[i];
	vector<ll> c(1e5+1,0);
	REP(i,n) {
		++c[a[i]];
		++c[a[i]+1];
		++c[a[i]+2];
	}
	ll res=0;
	REP(i,1e5+1) {
		res=max(res,c[i]);
	}
	cout<<res<<endl;
}

Submission Info

Submission Time
Task C - Together
User gazelle
Language C++14 (GCC 5.4.1)
Score 300
Code Size 918 Byte
Status AC
Exec Time 30 ms
Memory 1792 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 2 ms 1024 KB
0_001.txt AC 2 ms 1024 KB
0_002.txt AC 2 ms 1024 KB
1_003.txt AC 2 ms 1024 KB
1_004.txt AC 18 ms 1792 KB
1_005.txt AC 30 ms 1792 KB
1_006.txt AC 29 ms 1792 KB
1_007.txt AC 29 ms 1792 KB
1_008.txt AC 29 ms 1792 KB