Submission #2252344


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n;
	cin>>n;
	int a[101010]={};
	FOR(i,0,n){
		int c;
		cin>>c;
		if(c-1>=0)a[c-1]++;
		if(c+1<100001)a[c+1]++;
		a[c]++;

	}
	int mx=0;
	FOR(i,0,100001){
		mx=max(mx,a[i]);
	}
	cout<<mx<<endl;

    return 0;
}

Submission Info

Submission Time
Task C - Together
User kt_tenel
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1236 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 640 KB
0_001.txt AC 1 ms 640 KB
0_002.txt AC 1 ms 640 KB
1_003.txt AC 1 ms 640 KB
1_004.txt AC 20 ms 640 KB
1_005.txt AC 37 ms 640 KB
1_006.txt AC 37 ms 640 KB
1_007.txt AC 37 ms 640 KB
1_008.txt AC 36 ms 640 KB