Submission #1595615


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

const int N = 100010;

int n, a[N];
int cnt[N];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		if (a[i] > 0) cnt[a[i]-1]++;
		cnt[a[i]]++;
		cnt[a[i]+1]++;
	}

	int mx = 0;
	for (int i = 0; i < N; ++i) mx = max(mx, cnt[i]);
	cout << mx << endl;
}

Submission Info

Submission Time
Task C - Together
User cheater2k
Language C++14 (GCC 5.4.1)
Score 300
Code Size 388 Byte
Status AC
Exec Time 9 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 7 ms 640 KB
1_005.txt AC 9 ms 640 KB
1_006.txt AC 9 ms 640 KB
1_007.txt AC 9 ms 640 KB
1_008.txt AC 9 ms 1024 KB