hdu1506

时间:2021-03-04 15:59:57

today, my cc can't make '__in64'

it's so bad!!!

i don't know why

#include <stdio.h>
//long long num[100000+100];
__int64 num[+];
__int64 res;
//long long res;
int main(){long long res;
int n,i;
int left[+];
int right[+];
int t;
while(~scanf("%d",&n)&&n){
res=;
for(i=;i<=n;++i){
scanf("%I64d",&num[i]);
}
left[]=;
right[n]=n;
for(i=;i<=n;++i){
t=i;
while(t>&&num[i]<=num[t-]){
t=left[t-];
}
left[i]=t;
}
for(i=n-;i>=;--i){
t=i;
while(t<n&&num[i]<=num[t+]){
t=right[t+];
}
right[i]=t;
}
res=;
for(i=;i<=n;++i){
if((right[i]-left[i]+)*num[i]>res)
res=(right[i]-left[i]+)*num[i];
}
printf("%I64d\n",res);
// printf("%lld\n",res);
}
return ;
}