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 "mountains.h"
#include <bits/stdc++.h>
using namespace std;
int maximum_deevs(vector<int> y) {
int N = (int)y.size();
vector<int> memo(N, 0);
memo[N-1] = 1;
int best = 0;
int hi;
for(int i=N-2; i>=0; i--){
best = 0;
hi = y[i+1];
for(int j=i+2; j<N; j++){
//cout << i << " " << j << " " << hi << " " << y[i] << endl;
if(y[j] < hi || (hi > y[i] && y[j] <= hi)) //non lo vede
best = max(best, memo[j]);
hi = max(hi, y[j]);
}
memo[i] = best+1;
}
return *max_element(memo.begin(), memo.end());
}
# | 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... |