# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
642004 | 2022-09-18T09:01:31 Z | Tsiannis | medians (balkan11_medians) | C++14 | 44 ms | 5372 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define INF 10000009 int main () { ll n; cin>>n; ll B[n]; for (int i=0;i<n;i++){ cin>>B[i]; } ll A[2*n-1]; ll V[2*n]={}; A[0]=B[0]; ll mn=1; ll mx=2*n-1; if (A[0]==1) mn=2; if (A[0]==2*n-1) mx--; V[A[0]]=1; ll idx=1; for (int i=1;i<=2*n-2;i+=2){ if (B[idx]==B[idx-1]) { A[i]=mn; V[A[i]]=1; A[i+1]=mx; V[A[i+1]]=1; } else { A[i]=B[idx]; V[A[i]]=1; if (B[idx]<B[idx-1]) A[i+1]=mn; else A[i+1]=mx; V[A[i+1]]=1; } idx++; while(V[mn]) { mn++; } while(V[mx]) { mx--; } } for (int i=0;i<2*n-1;i++) cout<<A[i]<<' '; cout<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Not a permutation |
2 | Incorrect | 1 ms | 212 KB | Not a permutation |
3 | Incorrect | 0 ms | 212 KB | Not a permutation |
4 | Incorrect | 0 ms | 212 KB | Not a permutation |
5 | Incorrect | 0 ms | 212 KB | Not a permutation |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Not a permutation |
8 | Incorrect | 0 ms | 212 KB | Not a permutation |
9 | Incorrect | 0 ms | 212 KB | Not a permutation |
10 | Incorrect | 0 ms | 212 KB | Not a permutation |
11 | Incorrect | 0 ms | 212 KB | Not a permutation |
12 | Incorrect | 1 ms | 212 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 | 4 ms | 648 KB | Not a permutation |
4 | Incorrect | 9 ms | 1108 KB | Not a permutation |
5 | Incorrect | 13 ms | 1876 KB | Not a permutation |
6 | Incorrect | 28 ms | 3556 KB | Not a permutation |
7 | Incorrect | 44 ms | 5372 KB | Not a permutation |