# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234048 | 2020-05-22T22:42:12 Z | DanerZein | Rice Hub (IOI11_ricehub) | C++14 | 0 ms | 0 KB |
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long ma=-1; int besthub(int R, int L, int X[], long long B){ vector<ll>T; T.push_back(0); for(int i=0;i<R;i++){ T.push_back(X[i]+T[T.size()-1]); } for(int i=0;i<R;i++){ for(int j=i+1;j<R;j++){ ll mi=(i+j)/2; if((mi-s)*X[mi]-(T[mi]-T[i])+(T[j+1]-T[mi+1])-(j-mi)*X[mi]<=B){ ma=max(ma,(ll)(j-i)+1); } } } return ma; }