# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
460576 | fuad27 | Rice Hub (IOI11_ricehub) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int x[], long long B) {
int MAX = 0;
long long c = 0;
for(int i = 0, j = 0;j<R;j++) {
c += x[j] - x[(i + j)/2];
while(B - c < 0) {
c -= x[(i + 1 + j)/2] - x[i];
i++;
}
MAX = max(MAX, j-i+1);
}
return MAX;
}
int main () {
int X[5] = {1, 2, 10, 12, 14};
cerr<<besthub(5, 20, X, 6);
}