#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
long long N,len,cost,A[100005],S[100005];
bool check(long long x) {
long long idx=(x+1)/2;
for (int i=idx; i+x/2<=N; i++)
if (cost>=((x-1)/2)*A[i]-(S[i-1]-S[i-1-(x-1)/2])+(S[i+x/2]-S[i])-(x-(x-1)/2-1)*A[i]) return 1;
return 0;
}
int besthub(int n, int L, int X[], long long B){
N=n,len=L,cost=B;
for (int i=0; i<N; i++) {
A[i+1]=X[i];
S[i+1]=S[i]+A[i+1];
}
int l=1,r=N,mid,res;
while (l<=r) {
mid=(l+r)/2;
if (check(mid)) { res=mid; l=mid+1; }
else r=mid-1;
}
return res;
}
Compilation message
ricehub.cpp:2:10: fatal error: grader.h: No such file or directory
#include "grader.h"
^~~~~~~~~~
compilation terminated.