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<bits/stdc++.h>
// #include "grader.cpp"
#include "ricehub.h"
using namespace std;
int qs[100010];
int besthub(int R, int L, int X[], long long B)
{
for(int i=2;i<=R;i++){
qs[i]=qs[i-1]+(X[i-1]-X[i-2]);
// printf("%d ",qs[i]);
}
// printf("\n");
int now=0,temp,ans=0;
for(int i=1, j=1;i<=R && j<=R;i++){
if(i!=1){//move i
now-=qs[(i+j)/2]-qs[i];
}
if(j<i)j=i,now=0;
temp=now;
while(j<R){//move j
temp+=(qs[j+1]-qs[(i+j+1)/2]);
// printf("%d %d %d\n",i,j+1,temp);
if(temp<=B) j++;
else break;
}
// printf("%d %d\n",i,j);
ans=max(ans,j-i+1);
}
return ans;
}
# | 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... |