| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 224527 | T0p_ | 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 <bits/stdc++.h>
// #include "ricehub.h"
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
int ans = 0;
for(int i=0 ; i<R ; i++)
{
long long temp = B;
int now = 1, j = i+1;
while(j < R)
{
if(temp < X[j] - X[i]) break ;
temp -= X[j] - X[i];
j++;
now++;
}
ans = max(ans, now);
}
return ans;
}
int arr[] = {1, 2, 10, 12, 14};
int main()
{
cout << besthub(5, 20, arr, 6ll) << endl;
}
