Submission #2251155
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define pii pair<ll,ll> const int sz=1e5+7; int main() { boost; int n,x,ans=0; cin>>n; int arr[n];map<int,int> m1; for(int i=0;i<n;i++) { cin>>arr[i]; m1[arr[i]]++; } for(int i=0;i<=sz;i++) { int p=m1[i+1]; int q=m1[i-1]; ans=max(ans,p+q+m1[i]); } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | at_17 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 536 Byte |
Status | AC |
Exec Time | 63 ms |
Memory | 5376 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 | 42 ms | 4992 KB |
0_001.txt | AC | 55 ms | 4992 KB |
0_002.txt | AC | 49 ms | 4992 KB |
1_003.txt | AC | 47 ms | 4992 KB |
1_004.txt | AC | 56 ms | 5376 KB |
1_005.txt | AC | 55 ms | 5376 KB |
1_006.txt | AC | 60 ms | 5376 KB |
1_007.txt | AC | 63 ms | 5376 KB |
1_008.txt | AC | 57 ms | 5376 KB |