# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
914773 | DucNguyen2007 | 쌀 창고 (IOI11_ricehub) | C++14 | 11 ms | 3672 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxN=1e5+5;
ll sum[maxN+1];
int a[maxN+1];
ll get(ll l,ll r)
{
if(l==0)
{
return sum[r];
}
else return sum[r]-sum[l-1];
}
bool check(ll len,int n,ll B,int a[])
{
ll l=0,r=len-1;
while(r<n)
{
ll p=(l+r)/2;
ll cur=(p-l+1)*a[p]-get(l,p)+get(p,r)-(r-p+1)*a[p];
if(cur<=B)
{
return true;
}
l++;
r++;
}
return false;
}
ll besthub(int n,int L,int a[],ll B)
{
sum[0]=a[0];
for(int i=1;i<n;i++)
{
sum[i]=sum[i-1]+a[i];
}
ll res,l=1,r=n;
while(l<=r)
{
ll mid=(l+r)/2;
if(check(mid,n,B,a))
{
res=mid;
l=mid+1;
}
else r=mid-1;
}
return res;
}
/*5 20 6
1 2 10 12 14*/
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |