#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 |
1 |
Correct |
0 ms |
12800 KB |
Output is correct |
2 |
Correct |
0 ms |
12800 KB |
Output is correct |
3 |
Correct |
0 ms |
12800 KB |
Output is correct |
4 |
Correct |
0 ms |
12800 KB |
Output is correct |
5 |
Correct |
0 ms |
12800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
12800 KB |
Output is correct |
2 |
Correct |
9 ms |
12800 KB |
Output is correct |
3 |
Correct |
13 ms |
12800 KB |
Output is correct |
4 |
Correct |
13 ms |
12800 KB |
Output is correct |
5 |
Correct |
17 ms |
12800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
12800 KB |
Output is correct |
2 |
Correct |
23 ms |
12800 KB |
Output is correct |
3 |
Correct |
31 ms |
12800 KB |
Output is correct |
4 |
Correct |
29 ms |
12800 KB |
Output is correct |
5 |
Correct |
24 ms |
12800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
278 ms |
12800 KB |
Output is correct |
2 |
Correct |
270 ms |
12800 KB |
Output is correct |
3 |
Correct |
314 ms |
12800 KB |
Output is correct |
4 |
Correct |
303 ms |
12800 KB |
Output is correct |
5 |
Correct |
258 ms |
12800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
290 ms |
12800 KB |
Output is correct |
2 |
Correct |
275 ms |
12800 KB |
Output is correct |
3 |
Correct |
278 ms |
12800 KB |
Output is correct |
4 |
Correct |
185 ms |
12800 KB |
Output is correct |
5 |
Correct |
196 ms |
12800 KB |
Output is correct |