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"
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
typedef long long ll;
int besthub(int R, int L, int X[], long long B){
int a=0;int b=0;
int ans=1;
ll curcos=0;
while(a<R && b<R){
int pm=(a+b)/2;
if(curcos<=B){
ans=max(ans,b-a+1);
if(b==R-1)break;
b++;
curcos+=X[b]-X[pm];
}
else{
curcos-=X[pm]-X[a];
a++;
}
int nm=(a+b)/2;
curcos+=(X[nm]-X[pm])*((nm-a)-(b-pm));
}
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... |