# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
756880 | 2023-06-12T10:59:46 Z | KN200711 | medians (balkan11_medians) | C++14 | 47 ms | 4156 KB |
# include <bits/stdc++.h> using namespace std; int ct[200001]; int mn, mx, N; void upd() { while(ct[mn] && mn <= N) mn++; while(ct[mx] && mx > 0) mx--; } int main() { scanf("%d", &N); vector<int> arr(N); for(int i=0;i<N;i++) scanf("%d", &arr[i]); vector<int> as; as.clear(); mn = 1; mx = 2 * N - 1; for(int i=0;i<N;i++) { if(i == 0) { as.push_back(arr[i]); ct[arr[i]]++; } else { upd(); if(arr[i] > arr[i - 1]) { as.push_back(arr[i]); as.push_back(mx); } else if(arr[i] < arr[i - 1]) { as.push_back(arr[i]); as.push_back(mn); } else { as.push_back(mn); as.push_back(mx); } ct[as.back()] = 1; ct[as[as.size() - 2]] = 1; } } for(int p=0;p<as.size();p++) printf("%d ", as[p]); printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Not a permutation |
2 | Incorrect | 1 ms | 212 KB | Not a permutation |
3 | Incorrect | 1 ms | 320 KB | Not a permutation |
4 | Incorrect | 1 ms | 312 KB | Not a permutation |
5 | Incorrect | 1 ms | 212 KB | Not a permutation |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Incorrect | 1 ms | 308 KB | Not a permutation |
8 | Incorrect | 1 ms | 212 KB | Not a permutation |
9 | Incorrect | 1 ms | 320 KB | Not a permutation |
10 | Incorrect | 1 ms | 212 KB | Not a permutation |
11 | Incorrect | 1 ms | 212 KB | Not a permutation |
12 | Incorrect | 1 ms | 312 KB | Not a permutation |
13 | Incorrect | 1 ms | 340 KB | Not a permutation |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Not a permutation |
2 | Incorrect | 2 ms | 468 KB | Not a permutation |
3 | Incorrect | 3 ms | 596 KB | Not a permutation |
4 | Incorrect | 6 ms | 960 KB | Not a permutation |
5 | Incorrect | 11 ms | 1552 KB | Not a permutation |
6 | Incorrect | 29 ms | 2736 KB | Not a permutation |
7 | Incorrect | 47 ms | 4156 KB | Not a permutation |