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>
#include "mountains.h"
using namespace std;
using ll = long long;
using vi = vector<ll>;
int maximum_deevs(vector<int> y) {
int n = y.size();
vector<int> dp(n, 1);
for(int i = 1; i < n; ++i) {
bool bigger = false;
set<int> seen;
for(int j = i - 1; j >= 0; --j) {
bigger |= (y[j] > y[i]);
auto it = seen.upper_bound(y[j]);
if(it != seen.end() && bigger) {
dp[i] = max(dp[i], dp[j] + 1);
}
seen.insert(y[j]);
}
}
return *max_element(dp.begin(), dp.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... |