이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <algorithm>
typedef long long ll;
using namespace std;
int besthub(int R, int L, int X[], long long B){
int l=0,r=0, m, MaxR=1;
ll b_gastado = 0;
while(r<R-1){
if (b_gastado<=B){
r++;
m=(l+r)/2;
b_gastado+=abs(X[r]-X[m]);
if (b_gastado<=B) MaxR=max(MaxR,r-l+1);
}else{
l++;
m=(l+r)/2;
b_gastado-=abs(X[m]-X[l-1]);
if (b_gastado<=B) MaxR=max(MaxR,r-l+1);
}
}
return MaxR;
}
# | 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... |