Submission #50927

#TimeUsernameProblemLanguageResultExecution timeMemory
50927win11905Rice Hub (IOI11_ricehub)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define long long long using namespace std; const int N = 1e5+5; long pref[N], A[N]; int besthub(int R, int L, int X[], long B) { for(int i = 1; i <= R; ++i) pref[i] = pref[i-1] + X[i-1]; int l = 1, r = R; auto calc = [&](int m, int l, int r) { long lhs = ((m-l+1) * pref[m]) - (pref[m] - pref[l-1]); long rhs = (pref[r] - pref[m-1]) - ((r-m+1) * pref[m]); return lhs + rhs <= B; }; while(l < r) { int m = (l + r) >> 1; bool st = false; for(int l = 1, r = m; r <= R; l++, r++) { int z = (l + r) >> 1; st |= calc(z, l, r); } if(st) l = m; else r = m - 1; } return l; } int r, l, x[N]; long b; int main() { cin >> r >> l >> b; for(int i = 0; i < r; ++i) cin >> x[i]; cout << besthub(r, l, x, b); }

Compilation message (stderr)

/tmp/ccQjuuCM.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cclAzHJi.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status