# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
530455 | ala2 | Mountains (IOI17_mountains) | C++14 | 0 ms | 308 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<bits/stdc++.h>
#include "mountains.h"
#include <vector>
using namespace std;
int v[10010];
int a[10000];
int n;
int mx;
void f(int i)
{
if(i==n)
{
int is=0;
for(int ii=0;ii<n;ii++)
{
for(int jj=ii+1;jj<n;jj++)
{
if(v[ii]==v[jj]&&v[ii]==1)
{
double m= ( (1.0*(a[jj]-a[ii]) ) / ( (jj-ii)*1.0) );
double b=a[ii]-m*ii;
//int is=0;
int bb=0;
for(int k=ii+1;k<jj;k++)
{
int x=m*k+b;
if(a[k]>x){
is=1;
}
}
if(is==0)
return ;
}
}
}
int g=0;
for(int bb=0;bb<n;bb++)
{
// cout<<v[bb]<<" ";
g+=v[bb];
}
mx=max(mx,g);
return ;
}
v[i]=0;
f(i+1);
v[i]=1;
f(i+1);
}
int maximum_deevs(vector<int> y) {
n=y.size();
for(int i=0;i<n;i++)
a[i]=y[i];
mx=0;
f(0);
return mx;
}
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... |