Submission #2251133
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> 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<n;i++) { int p=m1[arr[i]-1]; int q=m1[arr[i]+1]; ans=max(ans,p+q+1); } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | at_17 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 519 Byte |
Status | WA |
Exec Time | 74 ms |
Memory | 5120 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 8 ms | 640 KB |
1_005.txt | WA | 11 ms | 640 KB |
1_006.txt | WA | 11 ms | 640 KB |
1_007.txt | WA | 18 ms | 640 KB |
1_008.txt | WA | 74 ms | 5120 KB |