Submission #255114

# Submission time Handle Problem Language Result Execution time Memory
255114 2020-07-31T09:52:12 Z babo Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "besthub.h"
#define L long long

using namespace std;

L a[100010],nu[100010];
L n,b;

bool ok(L x){
	L i;
	L sum=0;
	for(i=0;i<n-x+1;i++)
	{
		L s=i,e=i+x-1,mid=(s+e)/2;
		sum+=a[mid]*(mid-i+1)-(i==0?nu[mid]:(nu[mid]-nu[i-1]));
		sum+=(nu[e]-nu[mid])-a[mid]*(e-mid+1);
	}
	return sum<=b;
}

int besthub(int R,int L,int *X,L B){
	L i;
	for(i=0;i<R;i++)
		a[i]=nu[i]=X[i];
	for(i=1;i<R;i++)
		nu[i]+=nu[i-1];
	n=R,b=B;
	L s=1,e=R;
	while(s<e)
	{
		L mid=(s+e+1)/2;
		if(ok(mid)) s=mid;
		else e=mid-1;
	}
	return (int)s;
}

Compilation message

ricehub.cpp:2:10: fatal error: besthub.h: No such file or directory
 #include "besthub.h"
          ^~~~~~~~~~~
compilation terminated.