# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
80196 | farukkastamonuda | 쌀 창고 (IOI11_ricehub) | C++14 | 41 ms | 14820 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long
#define inf 1000000000
#define md 1000000007
#define li 100005
#define mp make_pair
#define pb push_back
using namespace std;
int n,T[10],mx,ans;
lo int A[li],pre[li],b;
bool chechk(lo int l,lo int r){
int mid=(l+r)/2;
lo int sum=1ll*A[mid]*(mid-l+1)-(pre[mid]-pre[l-1]);
sum+=(pre[r]-pre[mid-1])-1ll*A[mid]*(r-mid+1);
return sum<=b;
}
int besthub(int R,int L,int X[],lo int B){
n=R;
for(int i=1;i<=n;i++) A[i]=X[i-1];
mx=L;
b=B;
for(int i=1;i<=n;i++) pre[i]=pre[i-1]+A[i];
for(int i=1;i<=n;i++){
int l=i,r=n;
while(l<=r){
int mid=(l+r)/2;
if(chechk(i,mid)) l=mid+1;
# | 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... |