답안 #136415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
136415 2019-07-25T09:19:38 Z miguel 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include<ricehub.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define int ll
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
const ll mod = 998244353;

int besthub(int n, int l, int x[], int b){
    int s[n+1];
    int ans=0;
    s[0]=x[0];
    s[n]=1000000000000000000;
    for(int i=1; i<n; i++) s[i]=s[i-1]+x[i];
    for(int i=0; i<n; i++){
        int l=0, r=n-i;
        while(r-l>1){
            int mid=(l+r)>>1;
            int start=i, end=i+mid;
            int xd=(start+end)/2;
            if((x[xd]*(2*xd-start-end)-s[xd-1]+s[start-1]+s[end]-s[xd])<=b) l=mid;
            else r=mid;
        }
        ans=max(ans, l);
    }
    return ans;
}

Compilation message

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