이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "ricehub.h"
#define fi first
#define se second
using namespace std;
const int NN=1e5;
long long t[NN+10];
void move_med(int l,int r,int &m,long long &w)
{
if(m==(l+r)/2)
return;
w+=(t[m+1]-t[m])*(m-l+1);
w-=(t[m+1]-t[m])*(r-m);
m++;
return;
}
int besthub(int R,int L,int X[],long long B)
{
for(int i=0;i<R;i++)
t[i]=X[i];
int ans=0;
int l=0,r=0,m=0;
long long w=0;
while(l<R)
{
if(w>B)
{
w-=X[m]-X[l];
l++;
move_med(l,r,m,w);
}
else
{
ans=max(ans,r-l+1);
r++;
if(r>=R)
break;
w+=X[r]-X[m];
move_med(l,r,m,w);
}
}
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... |