Submission #2203776
Source Code Expand
#include <iostream> #include <vector> #include <map> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for( int i = 0; i < N; ++i ) cin >> a[i]; map<int, int> b; for( int i = 0; i < N; ++i ){ if( b.find(a[i]+1) == b.end() ) b[a[i]+1] = 1; else b[a[i]+1] += 1; if( b.find(a[i]-1) == b.end() ) b[a[i]-1] = 1; else b[a[i]-1] += 1; if( b.find(a[i]) == b.end() ) b[a[i]] = 1; else b[a[i]] += 1; } int ans = 1; for( int i = 0; i < N; ++i ) ans = ans < b[i] ? b[i] : ans; cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | canon4444 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 667 Byte |
Status | AC |
Exec Time | 126 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 | 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 | 43 ms | 5376 KB |
1_005.txt | AC | 58 ms | 5376 KB |
1_006.txt | AC | 57 ms | 5376 KB |
1_007.txt | AC | 70 ms | 5376 KB |
1_008.txt | AC | 126 ms | 5376 KB |