#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
const int maxn = 3e5 + 10, inf = 2e9;
int n, d;
int a[maxn];
int r[maxn];
vector <int> v;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> d;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
a[n + 1] = inf;
v.push_back(n + 1);
int naj = 0;
for(int i = n; i >= 1; i--){
while(a[i] >= a[v.back()]) v.pop_back();
r[i] = v.back();
v.push_back(i);
naj = max(naj, (int)v.size() - 1
);
}
cout << naj;
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |