Submission #1062203

#TimeUsernameProblemLanguageResultExecution timeMemory
1062203vjudge1Mountains (IOI17_mountains)C++17
100 / 100
12 ms16216 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...