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;
using ll = long long int;
#define pb push_back
int besthub(int R, int L, int X[], ll B){
ll p=0,ans=0,c=0,m=0;
for(ll i=0; i<R; i++){
if(m-i<p-m){
c+=(X[m+1]-X[m])*(p-m-(m-i+1));
m++;
}
while(c<=B && p<R){
p++;
if(p!=R){
c+=X[p]-X[m];
if(m-i<p-m){
c+=(X[m+1]-X[m])*(p-m-(m-i+1));
m++;
}
}else{
ans=max(ans,p-i);
return ans;
}
}
ans=max(ans,p-i);
c-=X[m]-X[i];
}
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... |