#include "ricehub.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long
#define inf 1000000000
#define md 1000000007
#define li 100005
#define mp make_pair
#define pb push_back
using namespace std;
lo int n,T[10],mx,b,ans;
lo int A[li],pre[li];
bool chechk(lo int l,lo int r){
lo int mid=(l+r)/2;
lo int sum=A[mid]*(mid-l+1)-(pre[mid]-pre[l-1]);
sum+=(pre[r]-pre[mid-1])-A[mid]*(r-mid+1);
return sum<=b;
}
lo int besthub(lo int R,lo int L,lo int X[],lo int B){
n=R;
for(int i=1;i<=n;i++) A[i]=X[i-1];
mx=L;
b=B;
for(int i=1;i<=n;i++) pre[i]=pre[i-1]+A[i];
for(int i=1;i<=n;i++){
lo int l=i,r=n;
while(l<=r){
int mid=(l+r)/2;
if(chechk(i,mid)) l=mid+1;
else r=mid-1;
}
ans=max(ans,l-i);
}
return ans;
}
//~ int main(){
//~ T[0]=1,T[1]=2,T[3]=10,T[4]=12,T[5]=14;
//~ int ty=besthub(5,20,T,6);
//~ printf("%d\n",ty);
//~ return 0;
//}
Compilation message
/tmp/ccNMICtT.o: In function `main':
grader.cpp:(.text.startup+0x92): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status