Submission #60128

#TimeUsernameProblemLanguageResultExecution timeMemory
60128streifiRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; #define int long long int R, L, B; vector<int> lft, rght; vector<int> v; bool check(int sz) { for (int l = 0; l+sz-1 < R; ++l) { int r = l+sz-1; int med = (l+r)/2; //cout << l << " " << med << " " << r << endl; //cout << lft[r+1]-lft[med+1] << " " << rght[l+1]-rght[med+1] << endl; int cur = lft[r+1]-lft[med+1]-(r-med)*v[med] + rght[l+1]-rght[med+1]-(med-l)*(L-v[med]); //cout << cur << endl; if (cur <= B) return true; } return false; } signed main() { cin >> R >> L >> B; lft.resize(R+2, 0); rght.resize(R+2, 0); v.resize(R); for (int i = 0; i < R; ++i) { cin >> v[i]; } for (int i = 1; i <= R; ++i) { lft[i] = lft[i-1]+v[i-1]; } for (int i = R; i >= 1; --i) { rght[i] = rght[i+1]+(L-v[i-1]); } int ans = 0; for (int msk = (1 << 20); msk > 0; msk >>= 1) { if ((ans | msk) <= R && check(ans | msk)) { ans |= msk; } } cout << ans << endl; }

Compilation message (stderr)

/tmp/ccn5NE8A.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc6qR5cb.o:ricehub.cpp:(.text.startup+0x0): first defined here
/tmp/ccn5NE8A.o: In function `main':
grader.cpp:(.text.startup+0x92): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status