Submission #411222

#TimeUsernameProblemLanguageResultExecution timeMemory
411222LouayFarahRice Hub (IOI11_ricehub)C++14
42 / 100
1086 ms460 KiB
#include "bits/stdc++.h" #include "ricehub.h" using namespace std; long long S(int X[], int h, int l, int r) { long long sum = 0; for(int i = l; i<=r; i++) sum = sum + abs(h-X[i]); return sum; } int besthub(int R, int L, int X[], long long B) { int res = 0; for(int l = 0; l<R; l++) { for(int r = l; r<R; r++) { int h = X[(l+r)/2]; long long curr = S(X, h, l, r); if(curr <=B) res = max(res, r-l+1); } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...