Submission #1327706

#TimeUsernameProblemLanguageResultExecution timeMemory
1327706arman.khachatryanRice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
long long besthub(int r, int l, int a[], int b){
    int j, k, c, ans=0, cnt;
    for(int i=0; i<r; i++){
        j=i-1;
        k=i+1;
        cnt=0;
        c=b;
        while(c>0){
            if(0<=j && (k>=r || a[i]-a[j]<=a[k]-a[i])){
                j--;
                cnt++;
                c-=a[i]-a[j];
            }else if(k<r && (j<0 || a[i]-a[j]>=a[k]-a[i])){
                k++;
                cnt++;
                c-=a[k]-a[i];
            }
        }
        ans=max(ans, cnt);
    }
    return ans+1;
}

Compilation message (stderr)

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