Submission #1558497
Source Code Expand
#include <iostream> #include <algorithm> #include <vector> using namespace std ; #define ll long long int ll tab[100001] ; int main() { ll n ; cin>>n ; ll arr[n] ; for(ll i = 0 ; i< n ; ++i) { cin>>arr[i] ; tab[arr[i]]++ ; } ll ans = max(tab[0] + tab[1] , tab[100000] + tab[99999] ) ; for(ll i = 1 ; i < n ; ++i ) { ans = max( ans , tab[i] + tab[i-1] + tab[i + 1]) ; } cout<<ans ; return 0 ; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | ashunimbz |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 510 Byte |
Status | AC |
Exec Time | 30 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 | 30 ms | 1792 KB |