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 "ricehub.h"
#include <iostream>
#include <cmath>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
for(int s=R;s>=1;s--){ // Recorre los tamaños
for(int i=0;i<=R-s;i++){ // Generamos el rango
int a = i;
int b = i+s-1;
int m = (a+b)/2;
long long sum = 0LL;
for(int j=i;j<i+s;j++){ // Recorremos el rango
long long dif = abs(X[j]-X[m]);
sum+=dif;
}
if(sum<=B){
return s;
}
}
}
return 1;
}
# | 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... |