Submission #735091

#TimeUsernameProblemLanguageResultExecution timeMemory
735091tigarRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; typedef long long ll; ll prefs[100010]; ll cost(ll l, ll r, ll *x) { ll m=(l+r)/2; return prefs[r+1]-prefs[m+1]-(r-m)*x[m]-prefs[m]+prefs[l]+(m-l)*x[m]; } int besthub(ll R, ll L, ll *X, ll B) { prefs[0]=0; for(int i=1; i<=R; i++)prefs[i]=prefs[i-1]+X[i-1]; ll k=0, ans=0; for(int i=0; i<R; i++) { while(cost(k, i, X)>B and k<i)k++; //cout<<cost(k, i, X)<<endl;; ans=max(i-k+1, ans); } //cout <<cost(0, 4, X)<<endl; return ans; } /*int main() { int r, l, x[100010]; ll b; cin>>r>>l>>b; for(int i=0; i<r; i++)cin>>x[i]; //cin>>b; cout<<besthub(r, l, x, b); return 0; }*/

Compilation message (stderr)

/usr/bin/ld: /tmp/ccxay62E.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