# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
443037 | hibye1217 | 쌀 창고 (IOI11_ricehub) | C++17 | 16 ms | 2508 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifndef NOTSUBMIT
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#endif // NOTSUBMIT
typedef long long ll;
ll sum[100020];
int besthub(int R, int L, int X[], ll B){
for (int i = 1; i <= R; i++){ sum[i] = sum[i-1] + X[i-1]; }
int st = 1, ed = R, ans = 1;
while (st <= ed){
int mid = st + ed >> 1;
ll res = 1e18;
for (int e = mid; e <= R; e++){
int s = e-mid+1;
int m = s+e >> 1;
int lc = m-s+1, rc = e-m;
ll ls = lc*X[m-1] - (sum[m]-sum[s-1]);
ll rs = (sum[e]-sum[m]) - rc*X[m-1];
//cout << "RS " << sum[e] << ' ' << sum[m] << ' ' << rc << ' ' << X[m] << endl;
//cout << "MID " << s << ' ' << m << ' ' << e << " = " << ls<<' '<<rs << endl;
res = min(res, ls+rs);
}
if (res <= B){ st = mid+1; ans = mid; }
else{ ed = mid-1; }
}
return ans;
}
컴파일 시 표준 에러 (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... |