# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1061356 | vjudge1 | Mountains (IOI17_mountains) | C++17 | 524 ms | 8600 KiB |
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 C[2010][2010];
vector<int>adj[2010];
int DDDP[1<<20];
int maximum_deevs(vector<int> y) {
int n=y.size();
for(int i=1;i<n;i++){
int uuu=i-1;
C[i][i-1]=C[i-1][i]=1;
for(int j=i-1;j--;) {
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)
C[i][j]=C[j][i]=1,uuu=j;
}
}
int ans=0;
int sz1=n/2,sz2=n-sz1;
for(int i=0;i<1<<sz2;i++){
vector<int>v;
for(int j=0;j<sz2;j++) if(i&1<<j)
v.push_back(sz1+j),DDDP[i]=max(DDDP[i],DDDP[i^1<<j]);
int bad=0;
for(auto A:v)
for(auto B:v)
if(C[A][B])
bad=1;
if(!bad)DDDP[i]=v.size();
}
Compilation message (stderr)
# | 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... |