# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
770579 | ByeWorld | 쌀 창고 (IOI11_ricehub) | C++14 | 13 ms | 2940 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define ll long long
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii, int> ipii;
const int MAXN = 1e5+100;
const ll INF = 2e18+10;
int n; ll b;
int a[MAXN]; ll pref[MAXN];
bool cost(int cnt){
ll mn = INF;
for(int l = 1; l+cnt-1 <= n; l++){
int r = l + cnt-1; int mid = ((l+r+1)>>1);
if((pref[r]-pref[mid-1]) - 1ll*(r-mid+1)*a[mid] + (1ll*(mid-l)*a[mid])-(pref[mid-1]-pref[l-1]) <= b) return 1;
}
return 0;
}
int besthub(int R, int L, int X[], long long B){
n = R; b = B;
for(int i=1; i<=n; i++){
a[i] = X[i-1]; pref[i] = pref[i-1] + a[i];
}
int l = 1; int r = n; int mid = 0; int cnt = 0;
while(l <= r){
mid = ((l+r)>>1);
if(cost(mid)){
cnt = mid; l = mid+1;
} else r = mid-1;
}
return cnt;
}
컴파일 시 표준 에러 (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... |