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 <vector>
using namespace std;
const int N = 3e5 + 1;
int n, d, a[N], ans = 1;
vector <int> v;
signed main()
{
cin >> n >> d;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = n - 1; i >= 0; i--) {
while (v.size() && a[v.back()] <= a[i])
v.pop_back();
v.push_back(i);
cerr << v.size() << '\n';
ans = max(ans, (int)v.size());
}
cout << ans;
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... |