fzu 2136
#include<stdio.h>
#define inf 1000000000
#define N 110000
int a[N];
struct node {
int start,end;
}b[N];
int minn[N];
int main() {
int n,t,i,j,len;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
for(i=1;i<=n;i++) {
scanf("%d",&a[i]);
minn[i]=inf;
}
for(i=1;i<=n;i++) {
for(j=i-1;j>=1;j--)
if(a[j]>a[i])break;
b[i].start=j+1;
for(j=i+1;j<=n;j++)
if(a[j]>a[i])break;
b[i].end=j-1;
}
for(i=1;i<=n;i++) {
len=b[i].end-b[i].start+1;
for(j=1;j<=len;j++)
if(minn[j]>a[i])
minn[j]=a[i];
}
for(i=1;i<=n;i++)
printf("%d\n",minn[i]);
}
return 0;
}
#define inf 1000000000
#define N 110000
int a[N];
struct node {
int start,end;
}b[N];
int minn[N];
int main() {
int n,t,i,j,len;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
for(i=1;i<=n;i++) {
scanf("%d",&a[i]);
minn[i]=inf;
}
for(i=1;i<=n;i++) {
for(j=i-1;j>=1;j--)
if(a[j]>a[i])break;
b[i].start=j+1;
for(j=i+1;j<=n;j++)
if(a[j]>a[i])break;
b[i].end=j-1;
}
for(i=1;i<=n;i++) {
len=b[i].end-b[i].start+1;
for(j=1;j<=len;j++)
if(minn[j]>a[i])
minn[j]=a[i];
}
for(i=1;i<=n;i++)
printf("%d\n",minn[i]);
}
return 0;
}