Submission #1558491


Source Code Expand

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }
  int m = 112345;
  vi b(m, 0);
  rep (i, n) {
    b[a[i]] += 1;
    b[a[i] + 1] += 1;
    b[a[i] + 2] += 1;
  }
  int ans = 0;
  rep (i, m) {
    ans = max(ans, b[i]);
  }
  printf("%d\n", ans);

  return 0;
}

Submission Info

Submission Time
Task C - Together
User tspcx
Language C++14 (Clang 3.8.0)
Score 300
Code Size 1189 Byte
Status AC
Exec Time 12 ms
Memory 1272 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 4 ms 1272 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 9 ms 1024 KB
1_005.txt AC 12 ms 1024 KB
1_006.txt AC 12 ms 1024 KB
1_007.txt AC 12 ms 1024 KB
1_008.txt AC 12 ms 1024 KB