# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
715579 | vjudge1 | 쌀 창고 (IOI11_ricehub) | C++14 | 12 ms | 1492 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
long long findcost(int st,int en,int mid,vector<long long> &prefixSum,int *x){
return (mid-st)*x[mid]*1LL-(prefixSum[mid]-prefixSum[st]) + (prefixSum[en+1]-prefixSum[mid+1])-(en-mid)*x[mid]*1LL;
}
long long besthub(int n,int l,int x[],long long b){
long long cost,ans=1;
int mid,st,en,len,low=0,high=n-1,m,check = 0;
vector<long long> prefixSum(n+1,0);
for(int i=1;i<=n;i++)prefixSum[i] = prefixSum[i-1]+x[i-1];
//for(int i=1;i<=n;i++)cout<<prefixSum[i]<<" "; cout<<endl;
while(low<=high){
check = 0;
len = (low+high)/2;
for(st=0;st<n-len;st++){
en = st+len;
mid = (st+en)/2;
cost = findcost(st,en,mid,prefixSum,x);
if(cost <= b){
ans = max(ans,en-st+1LL);
check = 1;
break;
}
//cout<<st<<" "<<en<<" "<<cost<<endl;
}
컴파일 시 표준 에러 (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... |