#include<bits/stdc++.h>
using namespace std;
const int mx=1e6+50;
typedef long long ll;
int inf=1e9+10;
const int mod=1e9+7;
ll n,m,k;
vector<pair<int,int>>v;
int vis[mx];
ll ans=0;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int x;cin>>x;
v.push_back({x,i});
}
sort(v.rbegin(),v.rend());
int cur=0;
int 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||v[me+1].first!=v[me].first){
ans=max(ans,cur);
}
// cout<<cur;
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
1588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
1480 KB |
Output is correct |
2 |
Correct |
39 ms |
1496 KB |
Output is correct |
3 |
Correct |
49 ms |
1576 KB |
Output is correct |
4 |
Correct |
58 ms |
1556 KB |
Output is correct |
5 |
Correct |
56 ms |
1484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
571 ms |
12132 KB |
Output is correct |
2 |
Correct |
550 ms |
12108 KB |
Output is correct |
3 |
Correct |
566 ms |
21448 KB |
Output is correct |
4 |
Correct |
554 ms |
21416 KB |
Output is correct |
5 |
Correct |
535 ms |
20796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
539 ms |
12088 KB |
Output is correct |
2 |
Correct |
540 ms |
12060 KB |
Output is correct |
3 |
Correct |
549 ms |
20908 KB |
Output is correct |
4 |
Incorrect |
360 ms |
15048 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |