Submission #1591872


Source Code Expand

/*
 USER: josifte4
 LANG: C++
 TASK: camelot
 */
#include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
int n;
int arr[100006];
int cnt[100005];
int main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    memset(cnt, 0, sizeof cnt);
    for(int i = 0; i < n; i ++){
        cin >> arr[i];
        cnt[arr[i]] ++;
    }
    int mxx = 0;
    
    for(int num = 1; num <= 100000; num ++){
        mxx = max(mxx, cnt[num] + cnt[num - 1] + cnt[num + 1]);
    }
    cout << mxx << endl;
   
    return 0;
    
}

Submission Info

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