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 <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, d;
cin >> n >> d;
vector<ll> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
deque<ll> dq;
int ans = 0;
dq.push_back(v[n - 1]);
for (int i = n - 2; i >= 0; i--) {
while (dq.size() && v[i] >= dq.front()) dq.pop_front();
dq.push_front(v[i]);
ans = max(ans, (int) dq.size());
}
cout << ans;
}
# | 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... |