답안 #94751

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94751 2019-01-23T14:08:03 Z MvC 쌀 창고 (IOI11_ricehub) C++11
컴파일 오류
0 ms 0 KB
#include "ricehub.h"
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,m,l,r,mid,i;
ll b,x[nmax],s[nmax];
int ok(int k,int md)
{
    for(int i=k;i<=n;i++)
    {
        ll tot=-(s[i-md+1]-s[i-k])+1LL*(i-md+1-i+k)*x[md]+s[i]-s[i-md+1]-1LL*(i-i+md-1)*x[md];
        if(tot<=b)return 1;
    }
    return 0;
}
int besthub(int N,int m,ll y[],ll B)
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	b=B;
	n=N;
	for(i=1;i<=n;i++)
	{
	    x[i]=y[i-1];
	    s[i]=s[i-1]+x[i];
	}
	l=1,r=n;
	while(l<=r)
	{
	    mid=(l+r)/2;
	    if(ok(mid,(mid/2)+1))l=mid+1;
	    else r=mid-1;
	}
	if(ok(l-1,(l-1)/2+1))return max(l-1,1);
	else return 1;
}

Compilation message

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