# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
14815 | eaststar | medians (balkan11_medians) | C++98 | 33 ms | 1896 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
int a[200010],f,r;
int main(){
int i,n,m,k;
scanf("%d",&n);
scanf("%d",&m);
printf("%d",m);
a[m]=1;
r=n*2;
for(i=1;i<n;++i){
scanf("%d",&k);
if(k<m){
if(a[k]){
while(a[++f]);
printf(" %d",f);
}
else printf(" %d",k);
a[k]=1;
while(a[++f]);
printf(" %d",f);
a[f]=1;
}
else if(k==m){
while(a[++f]);
while(a[--r]);
printf(" %d %d",f,r);
a[k]=a[f]=a[r]=1;
}
else{
if(a[k]){
while(a[--r]);
printf(" %d",r);
}
else printf(" %d",k);
a[k]=1;
while(a[--r]);
printf(" %d",r);
a[r]=1;
}
m=k;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |