Submission #1557444


Source Code Expand

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int cnt[100002];
int n, a;

int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) {
		cin >> a;
		++cnt[a];
		++cnt[a + 1];
		if (a != 0) ++cnt[a - 1];
	}
	int res = 0;
	REP(i, 100001) res = max(res, cnt[i]);
	cout << res << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Together
User yupotown
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1130 Byte
Status AC
Exec Time 37 ms
Memory 640 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 20 ms 256 KB
1_005.txt AC 37 ms 256 KB
1_006.txt AC 37 ms 256 KB
1_007.txt AC 36 ms 256 KB
1_008.txt AC 36 ms 640 KB