# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
502840 | 2022-01-06T16:00:01 Z | wind_reaper | Rice Hub (IOI11_ricehub) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; int besthub(int R, int L, int X[], int64_t B){ int64_t temp = 0; int ans = 0; for(int l = 0, r = 0; l < R; l++){ while(r + 1 < R && temp + X[r + 1] - X[(l + r + 1) / 2] <= B){ temp += X[r + 1] - X[(l + r + 1)/2]; r++; ans = max(ans, r - l + 1); } temp += X[l] - X[(r + l + 1)/2]; } return ans; }