This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <algorithm>
using namespace std;
struct data{
int h,i;
bool operator<(const data&r)const{
return h<r.h;
}
}a[1000010];
int chk[1000010],ans,s=1;
int main(){
int i,n;
scanf("%d",&n);
for(i=1;i<=n;++i)scanf("%d",&a[i].h),a[i].i=i,chk[i]=1;
sort(a+1,a+n+1);
for(i=1;i<=n;++i){
chk[a[i].i]=0;
s+=chk[a[i].i-1]+chk[a[i].i+1]-1;
if(a[i].h!=a[i+1].h&&ans<s)ans=s;
}
printf("%d",ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |