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;
namespace {
vector<int> H;
int N;
}
void init(int N,vector<int> H){
::H = H;
::N = N;
}
int max_towers(int L,int R,int D){
vector DP(N,1);
for(int i=L;i<=R;i++) {
int maxi = 0;
for(int j=i-1;j>=L;j--) {
if(maxi-D>=H[i] and maxi-D>=H[j])DP[i]=max(DP[i],DP[j]+1);
maxi = max(maxi,H[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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |