Submission #2211038
Source Code Expand
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int n, a[100005];
int main() {
ios::sync_with_stdio ( false );
cin.tie ( 0 );
cin >> n;
rep(i, 0, n) {
int x; cin >> x;
x++;
a[x-1]++;
a[x+2]--;
}
rep(i, 1, 100005) a[i] += a[i-1];
int ans = 0;
rep(i, 0, 100005)
ans = max(ans, a[i]);
cout << ans << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Together |
User |
kage |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
779 Byte |
Status |
AC |
Exec Time |
9 ms |
Memory |
640 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
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 |
2 ms |
640 KB |
0_001.txt |
AC |
2 ms |
640 KB |
0_002.txt |
AC |
2 ms |
640 KB |
1_003.txt |
AC |
2 ms |
640 KB |
1_004.txt |
AC |
7 ms |
640 KB |
1_005.txt |
AC |
9 ms |
640 KB |
1_006.txt |
AC |
9 ms |
640 KB |
1_007.txt |
AC |
9 ms |
640 KB |
1_008.txt |
AC |
9 ms |
640 KB |