#include<bits/stdc++.h>
using namespace std;
int ar[1000005];
int add[1000005];
vector<pair<int,int> >v;
int cnt=0;
int 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
2 ms |
2524 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
7768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
8408 KB |
Output is correct |
2 |
Correct |
11 ms |
8152 KB |
Output is correct |
3 |
Correct |
17 ms |
8444 KB |
Output is correct |
4 |
Correct |
16 ms |
8408 KB |
Output is correct |
5 |
Correct |
16 ms |
8432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
170 ms |
25356 KB |
Output is correct |
2 |
Correct |
167 ms |
25528 KB |
Output is correct |
3 |
Correct |
173 ms |
25524 KB |
Output is correct |
4 |
Correct |
179 ms |
25524 KB |
Output is correct |
5 |
Correct |
167 ms |
25300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
185 ms |
24792 KB |
Output is correct |
2 |
Correct |
171 ms |
24752 KB |
Output is correct |
3 |
Correct |
176 ms |
24756 KB |
Output is correct |
4 |
Incorrect |
150 ms |
18872 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |