답안 #481431

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
481431 2021-10-20T19:38:09 Z Mihai_Eduard 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
bool verify(int r, int l, int x[], int b, int nr)
{
    int st, dr, mij, total;
    for(int i=0;i<r-nr+1;i++)
    {
        st=i;
        dr=i+nr-1;
        mij=(st+dr)/2;
        total=0;
        for(int j=st;j<=mij;j++)
            total+=x[mij]-x[j];
        for(int j=mij+1;j<=dr;j++)
            total+=x[j]-x[mij];
        if(total<=b)
            return true;
    }
    return false;
}

int besthub(int r, int l, int x[], int b)
{
    int st=1, dr=r+1, mij;
    while(dr-st>1)
    {
        mij=(st+dr)/2;
        if(verify(r,l,x,b,mij))
            st=mij;
        else
            dr=mij;
    }
    return st;
}

Compilation message

/usr/bin/ld: /tmp/cc7cP6cb.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status