Submission #83522

# Submission time Handle Problem Language Result Execution time Memory
83522 2018-11-08T18:11:20 Z Linst90 medians (balkan11_medians) C++11
10 / 100
188 ms 16724 KB
#include<iostream>
#include<map>
using namespace::std;
 
int r,l;
map<int,bool> m;
 
void gf(){
    while(m.count(l)) ++l;
    cout<<l<<' ';
    m[l++]=1;
}
 
void gl(){
    while(m.count(r)) --r;
    cout<<r<<' ';
    m[r--]=1;
}
 
int main(){
    int n;
    cin>>n;
    r=2*n-1;
    l=1;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    cout<<a[0]<<' ';
    m[a[0]]=1;
    for(int i=1;i<n;i++){
        if(m.count(a[i])){
            if(a[i-1]>a[i]) gf(),gf();
            if(a[i-1]<a[i]) gl(),gl();
            else gf(),gl();
        }else{
            m[a[i]]=1;
            cout<<a[i]<<' ';
            if(a[i-1]>a[i]) gf();
            else gl();
        }
    }
    cout<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Incorrect 2 ms 504 KB Output isn't correct
3 Incorrect 2 ms 616 KB Output isn't correct
4 Incorrect 2 ms 616 KB Output isn't correct
5 Incorrect 2 ms 736 KB Output isn't correct
6 Correct 3 ms 776 KB Output is correct
7 Incorrect 2 ms 872 KB Output isn't correct
8 Incorrect 3 ms 884 KB Output isn't correct
9 Incorrect 2 ms 1024 KB Output isn't correct
10 Incorrect 3 ms 1024 KB Output isn't correct
11 Incorrect 3 ms 1024 KB Output isn't correct
12 Incorrect 3 ms 1024 KB Output isn't correct
13 Incorrect 3 ms 1172 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1492 KB Output isn't correct
2 Incorrect 8 ms 1656 KB Output isn't correct
3 Incorrect 13 ms 2184 KB Output isn't correct
4 Incorrect 27 ms 3392 KB Output isn't correct
5 Incorrect 52 ms 5920 KB Output isn't correct
6 Incorrect 107 ms 10716 KB Output isn't correct
7 Incorrect 188 ms 16724 KB Output isn't correct