Submission #639735

#TimeUsernameProblemLanguageResultExecution timeMemory
639735bonkRice Hub (IOI11_ricehub)C++14
17 / 100
1088 ms468 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...