#include <stdio.h>
#include <algorithm>
using namespace std;
struct data{
int h,i;
bool operator<(const data&r)const{
if(h==r.h)return i<r.i;
return h<r.h;
}
}a[1000010];
int s[9],e[9],b[9],c[9],m,t,ans;
int main(){
int i,j,n;
scanf("%d",&n);
for(i=1;i<=n;++i)scanf("%d",&a[i].h),a[i].i=i;
sort(a+1,a+n+1);
if(!a[n].h){
puts("0");
return 0;
}
s[ans=m=1]=1,e[1]=n;
for(i=1;i<=n;){
do{
for(j=1,t=0;j<=m;++j){
if(s[j]<=a[i].i&&a[i].i<=e[j]){
if(s[j]<a[i].i)b[++t]=s[j],c[t]=a[i].i-1;
if(a[i].i<e[j])b[++t]=a[i].i+1,c[t]=e[j];
}
else b[++t]=s[j],c[t]=e[j];
}
for(j=1;j<=t;++j)s[j]=b[j],e[j]=c[j];
m=t;
}while(a[i].h==a[++i].h);
if(ans<m)ans=m;
}
printf("%d",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
8892 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
8892 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
8892 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
388 ms |
8892 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
8892 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |