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>
int inp[1000010], ord[1000010];
bool chk[1000010];
bool comp(const int &a,const int &b){return inp[a]<inp[b];}
int main()
{
int n,i;
scanf("%d",&n);
for(i=1;i<=n;i++)scanf("%d",inp+i), ord[i] = i;
std::sort(ord+1,ord+1+n,comp);
int now=1,ans=1;
chk[0]=chk[n+1]=1;
for(i=1;i<=n;i++){
int t = ord[i];
now+=1-chk[t-1]-chk[t+1];
chk[t]=1;
if(i==n || inp[t]!=inp[ord[i+1]])ans=std::max(ans,now);
}
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... |