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"
#define f(x,y) (long long)(in[y+1]-in[(x+y)/2+1-(y-x+1)%2])
int besthub(int n, int max_L, int in[], long long B){
int x=0, y=0, out=0;
long long sum=0;
while(x<n){
while(y+1<n && sum+f(x,y)<=B) sum+=f(x,y), y++;
out=out>y-x+1?out:y-x+1;
sum-=(long long)(in[(x+y)/2+1-(y-x+1)%2]-in[x]), x++;
} return out;
}
# | 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... |