Submission #284509

#TimeUsernameProblemLanguageResultExecution timeMemory
284509BasilhijazRice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include "ricehub.h" using namespace std; typedef long long ll; int besthub(int R, int L, ll X[], long long B) { ll pre[R + 1]; pre[0] = 0; for(int i = 0; i < R; i++){ pre[i + 1] = X[i] + pre[i]; } int lo = 0; int hi = R; while(lo < hi){ ll mid = (lo + hi + 1)/2; bool can = 0; for(int i = 0; i + mid - 1 < R; i++){ ll sum = 0; ll nos = (i + i + mid - 1)/2; sum += X[nos]*mid - (pre[nos] - pre[i]); sum += (pre[i + i + mid - 1] - pre[nos]) - X[nos]*mid; if(sum <= B){ can = 1; break; } } if(can){ lo = mid; } else{ hi = mid - 1; } } return lo; }

Compilation message (stderr)

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