Submission #1557427
Source Code Expand
/*input 1 99999 */ #include <bits/stdc++.h> using namespace std; const long long md=1e9+7; long long a[1000005],n,freq[100005]; int main(){ #ifdef ONLINE_JUDGE ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); #endif long long q,m,k,h,ans=0,sum=0,p,x,y; cin>>n; for(int i=0;i<n;++i){ cin>>a[i]; ++freq[a[i]]; } ans=freq[0]+freq[1]; for(int i=1;i<100004;++i){ ans=max(ans,freq[i]+freq[i-1]+freq[i+1]); } cout<<ans; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | aayush9 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 463 Byte |
Status | AC |
Exec Time | 29 ms |
Memory | 1792 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 | 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 | 17 ms | 1024 KB |
1_005.txt | AC | 29 ms | 1024 KB |
1_006.txt | AC | 29 ms | 1024 KB |
1_007.txt | AC | 29 ms | 1024 KB |
1_008.txt | AC | 29 ms | 1792 KB |