#include<bits/stdc++.h>
using namespace std;
const int mx=1e6+200;
typedef long long ll;
int inf=1e9+10;
const int mod=1e9+7;
ll n,m,k;
vector<pair<ll,int>>v;
int vis[mx];
ll ans=0;
ll a[mx];
int main(){
cin>>n;
a[0]=-1;
a[n+1]=-1;
for(int i=1;i<=n;i++){
cin>>a[i];
v.push_back({a[i],i});
}
sort(v.rbegin(),v.rend());
ll cur=0;
ll ans=0;
map<int,int>mp;
for(ll i=0;i<n;i++){
cur++;
ll me=v[i].second;
vis[me]=1;
if((vis[me+1])){
cur--;
} if(vis[me-1]){
cur--;
}
if(i==n-1||a[me+1]!=a[me]){
ans=max(ans,cur);
}
// cout<<cur;
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
34 ms |
3172 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
3152 KB |
Output is correct |
2 |
Correct |
39 ms |
3096 KB |
Output is correct |
3 |
Correct |
52 ms |
3120 KB |
Output is correct |
4 |
Correct |
61 ms |
3048 KB |
Output is correct |
5 |
Correct |
60 ms |
3112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
570 ms |
27780 KB |
Output is correct |
2 |
Runtime error |
568 ms |
37100 KB |
Memory limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
559 ms |
27748 KB |
Output is correct |
2 |
Runtime error |
570 ms |
36460 KB |
Memory limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |