Submission #2148239
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> a(n); for(int i = 0 ; i < n ; i ++) cin >> a[i]; int k = 0; int cnt[n]; for(int i = 0 ; i < n ; i ++) cnt[i] = 0; for(int i = 0 ; i < n ; i ++){ for(int j = 0 ; j < n ; j ++){ if(abs(k - a[j]) <= 1) cnt[i] ++; } k ++; } sort(cnt , cnt + n); if(n == 1) cout << 1 << endl; else cout << cnt[n - 1] << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | askfhy |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 515 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 1024 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 | TLE | 2103 ms | 1024 KB |
1_005.txt | TLE | 2103 ms | 1024 KB |
1_006.txt | TLE | 2103 ms | 1024 KB |
1_007.txt | TLE | 2103 ms | 1024 KB |
1_008.txt | TLE | 2103 ms | 1024 KB |