Submission #1557434


Source Code Expand

#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define nl '\n'
typedef long long ll;
typedef long double ld;
//////////////////////////////////////////////////////////////////////

int n;
map<int,int> mp;

int main(){
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  cin>>n;
  for(int i=1;i<=n;i++){
    int v;cin>>v;
    mp[v]++;
  }

  int ans = 0;
  for(int v=0;v<=100000;v++)
    ans = max(ans , mp[v-1] + mp[v] + mp[v+1] );

  cout << ans << nl;
  
  return 0;
};

Submission Info

Submission Time
Task C - Together
User ChestnutRice
Language C++14 (GCC 5.4.1)
Score 300
Code Size 564 Byte
Status AC
Exec Time 65 ms
Memory 4992 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 52 ms 4992 KB
0_001.txt AC 53 ms 4992 KB
0_002.txt AC 54 ms 4992 KB
1_003.txt AC 55 ms 4992 KB
1_004.txt AC 61 ms 4992 KB
1_005.txt AC 63 ms 4992 KB
1_006.txt AC 60 ms 4992 KB
1_007.txt AC 65 ms 4992 KB
1_008.txt AC 57 ms 4992 KB