Submission #227783

#TimeUsernameProblemLanguageResultExecution timeMemory
227783staniewzkiRice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using LL = long long; #include "ricehub.h" int besthub(int R, int L, int X[], LL B) { vector<LL> sum(R + 1); for(int i = 0; i < R; i++) sum[i + 1] = sum[i] + X[i]; auto get = [&](int l, int r) { int m = (l + r) / 2; return sum[r + 1] - sum[m] - X[m] * (r + 1 - m) + X[m] * (m - l) - sum[m] + sum[l]; }; for(int i = 0; i < R; i++) REP(i, R) while(p < R && get(i, p) <= B) ans = max(ans, p++ - i + 1); return ans; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, LL)':
ricehub.cpp:20:2: error: 'REP' was not declared in this scope
  REP(i, R)
  ^~~
ricehub.cpp:23:9: error: 'ans' was not declared in this scope
  return ans;
         ^~~
ricehub.cpp:23:9: note: suggested alternative: 'abs'
  return ans;
         ^~~
         abs