This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
typedef long long ll;
ll S[100010];
#define get(s,m,d) (S[(d)]-S[(m)]+X[(m)]*(2*(m)-(s)-(d))-S[(m)-1]+S[(s)-1])
int besthub(int R,int L,int *X,ll B)
{
int i,j,a=0;
for(i=R;i;i--)X[i]=X[i-1];
for(i=1;i<=R;i++)S[i]=S[i-1]+X[i];
for(i=j=1;i<=R;i++){
while(j<i&&get(j,(j+i)>>1,i)>B)j++;
a=a>i-j?a:i-j;
}
return a+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... |