# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1027092 | kkkkkkkk | Rice Hub (IOI11_ricehub) | C++14 | 1059 ms | 4312 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>
using namespace std;
vector<int> v;
long long B;
bool proveri(int k) {
for (int i=0;i<=v.size()-k;i++) {
int hub_poz=v[(i+i+k)/2];
long long zbir=0;
for (int j=i;j<i+k;j++)
zbir+=abs(hub_poz-v[j]);
if (zbir<=B) return true;
}
return false;
}
int besthub(int R, int L, int a[], long long b) {
B=b;
for (int i=0;i<R;i++)
v.push_back(a[i]);
int l=1, r=R+1;
while (l+1<r) {
int mid=(l+r)/2;
if (proveri(mid)) l=mid;
else r=mid;
}
return l;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |