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[100000+100]; __int64 res; //long long res; int main(){long long res; int n,i; int left[100000+10]; int right[100000+10]; int t; while(~scanf("%d",&n)&&n){ res=0; for(i=1;i<=n;++i){ scanf("%I64d",&num[i]); } left[1]=1; right[n]=n; for(i=2;i<=n;++i){ t=i; while(t>1&&num[i]<=num[t-1]){ t=left[t-1]; } left[i]=t; } for(i=n-1;i>=1;--i){ t=i; while(t<n&&num[i]<=num[t+1]){ t=right[t+1]; } right[i]=t; } res=0; for(i=1;i<=n;++i){ if((right[i]-left[i]+1)*num[i]>res) res=(right[i]-left[i]+1)*num[i]; } printf("%I64d ",res); // printf("%lld ",res); } return 0; }