Submission #255103

# Submission time Handle Problem Language Result Execution time Memory
255103 2020-07-31T09:40:26 Z babo Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.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

/tmp/ccGnF8Mk.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