# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
516271 |
2022-01-21T01:15:41 Z |
Jesus |
Rice Hub (IOI11_ricehub) |
C++14 |
|
0 ms |
0 KB |
#include<iostream>
#include "besthub.h"
int besthub(int R,int L,int X[], int B){
int izq=0;
int der=0;
int maxim=0;
long long int costo=0;
int i=0,j=0;
int z=0;
while(i<R){
if(j==R-1||costo>B) {
if(izq<der){
z=(i+j)/2;
costo-=X[z+1]-X[z-izq];
costo+=(X[z+1]-X[z])*(izq);
costo-=(X[z+1]-X[z])*(der);
izq++;
der--;
}
i++;
izq--;
}
else{
z=(i+j)/2;
if(izq<der){
costo+=X[z+1+der]-X[z+1];
costo+=(X[z+1]-X[z])*izq;
costo-=(X[z+1]-X[z])*(der-1);
}
else{
costo+=X[z+der+1]-X[z];
}
j++;
der++;
}
if(costo<=B) maxim=max(maxim,der+izq+1);
}
return maxim;
}
Compilation message
ricehub.cpp:2:10: fatal error: besthub.h: No such file or directory
2 | #include "besthub.h"
| ^~~~~~~~~~~
compilation terminated.