Submission #530456

#TimeUsernameProblemLanguageResultExecution timeMemory
530456ala2Mountains (IOI17_mountains)C++14
0 / 100
1 ms272 KiB
#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) { long double m= ( (1.0*(a[jj]-a[ii]) ) / ( (jj-ii)*1.0) ); long double b=a[ii]-m*ii; //int is=0; int bb=0; for(int k=ii+1;k<jj;k++) { long double 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=1; f(0); return mx; }

Compilation message (stderr)

mountains.cpp: In function 'void f(int)':
mountains.cpp:24:25: warning: unused variable 'bb' [-Wunused-variable]
   24 |                     int bb=0;
      |                         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...