#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(t==n || inp[t]!=inp[ord[i-1]])ans=std::max(ans,now);
}
printf("%d",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9876 KB |
Output is correct |
2 |
Correct |
0 ms |
9876 KB |
Output is correct |
3 |
Correct |
0 ms |
9876 KB |
Output is correct |
4 |
Correct |
0 ms |
9876 KB |
Output is correct |
5 |
Correct |
0 ms |
9876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
9876 KB |
Output is correct |
2 |
Correct |
16 ms |
9876 KB |
Output is correct |
3 |
Incorrect |
16 ms |
9876 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
9876 KB |
Output is correct |
2 |
Correct |
32 ms |
9876 KB |
Output is correct |
3 |
Correct |
28 ms |
9876 KB |
Output is correct |
4 |
Correct |
32 ms |
9876 KB |
Output is correct |
5 |
Correct |
32 ms |
9876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
448 ms |
9876 KB |
Output is correct |
2 |
Correct |
428 ms |
9876 KB |
Output is correct |
3 |
Correct |
440 ms |
9876 KB |
Output is correct |
4 |
Correct |
424 ms |
9876 KB |
Output is correct |
5 |
Correct |
408 ms |
9876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
444 ms |
9876 KB |
Output is correct |
2 |
Incorrect |
444 ms |
9876 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |