标签:des style blog http color java os io
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 11219 Accepted Submission(s):
3074
1 #include<stdio.h> 2 #include<string.h> 3 __int64 a[100010],L[100010],r[100010],max; 4 int main() 5 { 6 int i,j,n,t; 7 while(~scanf("%d",&n)&&n) 8 { 9 for(i=1; i<=n; i++) 10 scanf("%I64d",&a[i]); 11 L[1]=1; 12 r[n]=n; 13 for (i=2; i<=n; i++) 14 { 15 t=i; 16 while (t>1 && a[i]<=a[t-1]) 17 t=L[t-1]; 18 L[i]=t; 19 } 20 for (i=n-1; i>=1; i--) 21 { 22 t=i; 23 while (t<n && a[i]<=a[t+1]) 24 t=r[t+1]; 25 r[i]=t; 26 } 27 max=0; 28 for(i=1; i<=n; i++) 29 { 30 if((r[i]-L[i]+1)*a[i]>max) 31 max=(r[i]-L[i]+1)*a[i]; 32 } 33 printf("%I64d\n",max); 34 } 35 return 0; 36 }
标签:des style blog http color java os io
原文地址:http://www.cnblogs.com/lxm940130740/p/3903064.html