Submission #1595639
Source Code Expand
#include <iostream> #include <cstdio> #include <iostream> using namespace std; int main (void) { int s[150000] = {0}; int n; int i; int ans[150000] = {0}; long long max = 0; int c[150000] = {0}; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&s[i]); } sort(s,s+n); for(i=0;i<n;i++){ c[s[i]]++; } for(i=0;i<s[n-1];i++){ ans[i] = c[i] + c[i+1] + c[i+2]; } for(i=0;i<s[n-1];i++){ if(ans[i] > max){ max = ans[i]; } } /*for(i=0;i<s[n-1];i++){ printf("%d\n",ans[i]); }*/ /*for(i=0;i<s[n-1]-2;i++){ printf("%d\n",ans[i]); }*/ printf("%lld\n",max); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | tanimura |
Language | C++14 (Clang 3.8.0) |
Score | 0 |
Code Size | 758 Byte |
Status | WA |
Exec Time | 18 ms |
Memory | 2680 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 | 5 ms | 2680 KB |
0_001.txt | AC | 2 ms | 2048 KB |
0_002.txt | AC | 2 ms | 2176 KB |
1_003.txt | AC | 2 ms | 2048 KB |
1_004.txt | WA | 10 ms | 2048 KB |
1_005.txt | AC | 12 ms | 2048 KB |
1_006.txt | AC | 13 ms | 2048 KB |
1_007.txt | AC | 14 ms | 2048 KB |
1_008.txt | AC | 18 ms | 2048 KB |