| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1334086 | ElayV13 | Rice Hub (IOI11_ricehub) | C++20 | 0 ms | 344 KiB |
#include "ricehub.h"
#include "bits/stdc++.h"
using namespace std;
#define ll long long
int N;
ll p[5001];
ll get(int l,int r)
{
if(l>r) return 0;
if(!l) return p[r];
return p[r]-p[l-1];
}
int besthub(int R,int L,int X[],long long B)
{
N=R;
p[0]=X[0];
for(int i=1;i<N;i++) p[i]=p[i-1]+X[i];
ll res=0;
for(int i=0;i<R;i++){
ll l=i,r=R-1,mx=-1;
while(l<=r)
{
ll mid=(l+r)>>1;
bool f=0;
ll MID=(i+mid)>>1;
for(int sel=max(0ll,MID-1);sel<=min(R-1,(int)MID+1);sel++)
{
ll need=0;
ll cc1=sel-i;
ll cc2=mid-sel;
ll ff=(X[sel]*cc1)-get(i,sel-1);
ll ss=get(sel+1,mid)-(X[sel]*cc2);
if(ff+ss<=B) f=1;
}
if(f)
{
mx=max(mx,mid);
l=mid+1;
}
else r=mid-1;
}
if(mx!=-1) res=max(res,mx-i+1);
}
return res;
}
| # | 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... | ||||
