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 "towers.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
int n;
vi H;
void init(int N0, vi H0) {
n = N0;
H = H0;
}
int max_towers(int l, int r, int D) {
int re = 1;
vi DP(n, 1);
for(int i = l; i <= r; ++i) {
for(int j = l; j < i; ++j) {
int ma = 0;
for(int w = j; w <= i; ++w) ma = max(ma, H[w]);
if(ma >= D + max(H[i], H[j])) {
DP[i] = max(DP[i], DP[j] + 1);
re = max(re, DP[i]);
}
}
}
return re;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |