#include<bits/stdc++.h>
using namespace std;
const int mx=1000001;
typedef long long ll;
int inf=1e9+10;
const int mod=1e9+7;
int n,m,k;
vector<pair<ll,int>>v;
vector<pair<ll,ll>>adj[mx];
ll best[mx];
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());
int cur=0;
int ans=0;
map<int,int>mp;
for(int i=0;i<n;i++){
cur++;
vis[i]=1;
int me=v[i].second;
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
23792 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
26632 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
26544 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
572 ms |
51232 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
603 ms |
51192 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |