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"
long long s,e,sum[100005],x[100005],mx;
inline long long max(long long X,long long Y) {
return X>Y?X:Y;
}
long long calc(int X,int Y) {
long long k=(Y-X+1)/2;
return sum[Y]-sum[Y-k]-sum[X+k-1]+sum[X-1];
}
int besthub(int R, int L, int X[], long long B)
{
int i;
for(i=0;i<R;i++) {
x[i+1]=X[i];
sum[i+1]=sum[i]+x[i+1];
}
s=1; e=1;
while(s<=R && e<=R) {
if(calc(s,e)<=B) {
mx=max(mx,e-s+1);
e++;
}
else {
s++;
}
}
return mx;
}
# | 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... |