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"
using namespace std;
int DDDP[2010][2010];
int maximum_deevs(vector<int> y) {
int n=y.size();
y.insert(y.begin(),0);
DDDP[1][1]=1;
for(int i=2;i<=n;i++){
int uuu=i-1;
int K=1;
DDDP[i][i]=DDDP[i-1][i]=1;
for(int j=i-1;--j;) {
DDDP[j][i]=DDDP[j][i-1];
long long ht=y[j]-y[i],dt=i-j;
long long hb=y[uuu]-y[i],db=i-uuu;
if(ht*db>=hb*dt) {
K+=DDDP[j+1][uuu-1];
uuu=j;
}
DDDP[j][i]=max(DDDP[j][i],DDDP[j][uuu-1]+K);
}
}
return DDDP[1][n];
}
# | 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... |