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)
{
int now=0,temp,ans=1;
for(int i=0, j=0;i<R && j<R;i++){
if(i!=0) now-=X[(i+j)>>1]-X[i-1];
if(j<i)j=i,now=0;
temp=now;
while(j<(R-1)){//move j
temp+=(X[j+1]-X[(i+j+1)>>1]);
// 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);
if(j==R-1) break;
}
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... |