#include<bits/stdc++.h>
#define int long long
using namespace std;
int ar[1000005];
int add[1000005];
vector<pair<int,int> >v;
int cnt=0;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;cin>>n;
for(int i=1;i<=n;i++){
cin>>ar[i];
v.push_back({ar[i],i});
}
sort(v.begin(),v.end(),greater<pair<int,int>>());
int mx=0;
for(auto x:v){
add[x.second]=1;
int temp=0;
if(add[x.second-1])temp++;
if(add[x.second+1])temp++;
if(temp==0)cnt++;
if(temp==2)cnt--;
mx=max(mx,cnt);
}
cout<<mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
6864 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
6860 KB |
Output is correct |
2 |
Correct |
12 ms |
6868 KB |
Output is correct |
3 |
Correct |
20 ms |
7048 KB |
Output is correct |
4 |
Correct |
18 ms |
6868 KB |
Output is correct |
5 |
Correct |
17 ms |
6860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
189 ms |
32620 KB |
Output is correct |
2 |
Correct |
187 ms |
32172 KB |
Output is correct |
3 |
Correct |
190 ms |
32172 KB |
Output is correct |
4 |
Correct |
196 ms |
31920 KB |
Output is correct |
5 |
Correct |
184 ms |
31756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
32116 KB |
Output is correct |
2 |
Correct |
197 ms |
31652 KB |
Output is correct |
3 |
Correct |
184 ms |
31696 KB |
Output is correct |
4 |
Incorrect |
177 ms |
31660 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |