Submission #1608316
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; ++i) { int x; cin >> x; a[i] = x; } sort(a.begin(), a.end()); int start = a[0]; int end = a[n-1]; int ans = 0; for(int i = start; i <= end; ++i) { if(find(a.begin(), a.end(), i) == a.end()) continue; auto e1 = lower_bound(a.begin(), a.end(), i-1); auto e2 = upper_bound(a.begin(), a.end(), i+1); // cout << *e2 << " " << *e1 << '\n'; int temp = e2 - e1; ans = max(ans, (temp)); // cout << i << " " << ans << "\n\n"; } cout << ans << '\n'; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | lightyagami1 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 787 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 640 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 | AC | 9 ms | 640 KB |
1_005.txt | AC | 11 ms | 640 KB |
1_006.txt | AC | 11 ms | 640 KB |
1_007.txt | AC | 15 ms | 640 KB |
1_008.txt | TLE | 2103 ms | 640 KB |