Submission #204512

# Submission time Handle Problem Language Result Execution time Memory
204512 2020-02-26T07:59:53 Z alexandra_udristoiu medians (balkan11_medians) C++14
5 / 100
76 ms 4144 KB
#include<iostream>
#define DIM 200005
using namespace std;
int n, i, p, u;
int v[DIM], ff[DIM], sol[DIM];
int main(){
    cin>> n;
    for(i = 1; i <= n; i++){
        cin>> v[i];
    }
    sol[1] = v[1];
    ff[ v[1] ] = 1;
    p = 1;
    u = 2 * n - 1;
    for(i = 2; i <= n; i++){
        while(ff[p] == 1){
            p++;
        }
        while(ff[u] == 1){
            u--;
        }
        if(v[i] == v[i - 1]){
            sol[2 * i - 2] = p;
            sol[2 * i - 1] = u;
            ff[p] = ff[u] = 1;
        }
        else{
            sol[2 * i - 2] = v[i];
            ff[ v[i] ] = 1;
            if(v[i] > v[i - 1]){
                sol[2 * i - 1] = u;
                ff[u] = 1;
            }
            else{
                sol[2 * i - 1] = p;
                ff[p] = 1;
            }
        }
    }
    for(i = 1; i <= 2 * n - 1; i++){
        cout<< sol[i] <<" ";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Not a permutation
2 Incorrect 5 ms 248 KB Not a permutation
3 Incorrect 5 ms 380 KB Not a permutation
4 Incorrect 5 ms 376 KB Not a permutation
5 Incorrect 5 ms 376 KB Not a permutation
6 Correct 5 ms 376 KB Output is correct
7 Incorrect 5 ms 376 KB Not a permutation
8 Incorrect 7 ms 432 KB Not a permutation
9 Incorrect 5 ms 380 KB Not a permutation
10 Incorrect 5 ms 376 KB Not a permutation
11 Incorrect 5 ms 376 KB Not a permutation
12 Incorrect 5 ms 380 KB Not a permutation
13 Incorrect 5 ms 376 KB Not a permutation
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Not a permutation
2 Incorrect 7 ms 504 KB Not a permutation
3 Incorrect 9 ms 632 KB Not a permutation
4 Incorrect 15 ms 888 KB Not a permutation
5 Incorrect 26 ms 1528 KB Not a permutation
6 Incorrect 46 ms 2680 KB Not a permutation
7 Incorrect 76 ms 4144 KB Not a permutation