This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
#define fff(i, a, b) for(ll i = a; i < b; i++)
#define MAXN 1000006
bool sim[MAXN];
int main(){
ll n; cin >> n;
vector<pair<ll, ll>> v;
fff(i, 0, n){
ll a; cin >> a;
v.emplace_back(a, i+1);
}
sort(v.rbegin(), v.rend());
// fff(i, 0, n){
// cout << v[i].first << " " << v[i].second << endl;
// } cout << endl;
ll best = 0;
ll cur = 0;
fff(i, 0, n){
auto [h, j] = v[i];
sim[j] = 1;
cur++;
if (sim[j+1]) cur--;
if (sim[j-1]) cur--;
if (cur > best) best = cur;
}
cout << best << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |