P5155
#include <bits/stdc++.h>
using namespace std;
inline void read(long long&x){
char c11=getchar();x=0;while(!isdigit(c11))c11=getchar();
while(isdigit(c11))x=x*10+c11-'0',c11=getchar();
}
int n,tp;
struct vec{
int x;long long y;
inline vec(){}
inline vec(const int&X,const long long&Y):x(X),y(Y){}
friend inline vec operator - (const vec&A,const vec&B) {return vec(A.x-B.x,A.y-B.y);}
friend inline long long operator * (const vec&A,const vec&B) {return A.x*B.y-A.y*B.x;}
}p,st[101000];
void push(vec p){
while(tp&&(p-st[tp])*(st[tp]-st[tp-1])<=0)--tp;
st[++tp]=p;
}
int main(){
scanf("%d",&n);
vec p;
for(int i=1;i<=n;++i)p.x=i,read(p.y),p.y*=100000,push(p);
push(vec(n+1,0));
for(int i=1,j=0;i<=n;++i){
while(j<tp&&st[j].x<i)++j;
if(st[j].x==i)printf("%lld\n",st[j].y);
else printf("%lld\n",((st[j].x-i)*st[j-1].y+(i-st[j-1].x)*st[j].y)/(st[j].x-st[j-1].x));
}
return 0;
}
今天开写这么晚的原因是研究了1919810ms的AC自动机……