Submission #1793348


Source Code Expand

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  map<int,int>m;
  int n;
  cin>>n;
  rep(i,n){
    int x;
    cin>>x;
    m[x]++;
    m[x-1]++;
    m[x+1]++;
  }
  pi ans;ans.second=0;
  for(auto itr : m){
    if(itr.second > ans.second){
      ans.second=itr.second;
      ans.first=itr.first;
    }
    //cout<<itr.first<<" "<<itr.second<<endl;
  }
  cout<<ans.second<<endl;
  return 0;
}

Submission Info

Submission Time
Task C - Together
User mkan_0141
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1244 Byte
Status AC
Exec Time 87 ms
Memory 4736 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 18 ms 256 KB
1_005.txt AC 31 ms 256 KB
1_006.txt AC 31 ms 256 KB
1_007.txt AC 34 ms 256 KB
1_008.txt AC 87 ms 4736 KB