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;
using ll = long long;
int besthub(int r, int l, int x[], ll b){
ll ans = 0;
for(ll i = 0; i < r; i++){
ll cur = 0;
for(ll j = i; j < r; j++){
cur += x[j];
ll mid = cur/(j - i + 1);
ll cost = 0;
for(ll k = i; k <= j; k++){
cost += abs(x[k] - mid);
}
if(cost <= b) ans = max(ans, j - i + 1);
}
}
return ans;
}
# | 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... |