Submission #1216904

#TimeUsernameProblemLanguageResultExecution timeMemory
1216904lizi14Rice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], long long B) { //vector<int>v; long long ps[L]; fill(x,x+L,0); for(int i=0; i<R; i++){ //v.push_back(X[i]); ps[i]=X[i]; if(i>0){ ps[i]+=ps[i-1]; } } int l=0,r=R; int bati=0; while(l<=r){ int mid=(l+r)/2; long long ans=1e9; for(int i=mid/2-1; i<R-mid/2; i++){ long long ans1=(mid/2)*X[i]-ps[i-1]*(mid/2); ans1+=(ps[i+mid/2]-ps[i])*(mid/2)-(mid/2)*X[i]; ans=min(ans1,ans); } if(ans>B){ r=mid-1; } else{ l=mid+1; bati=mid; } } return bati; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:9:10: error: 'x' was not declared in this scope
    9 |     fill(x,x+L,0);
      |          ^