# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
364905 | hoaphat1 | Rice Hub (IOI11_ricehub) | C++17 | 21 ms | 2668 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int besthub(int n, int lim, int a[], long long b) {
int l = 1, r = n;
vector<long long> t(n);
for (int i = 0; i < n; i++) {
t[i] = a[i];
if (i) t[i] += t[i-1];
}
auto getv = [&](int l, int r) {
if (!l) return t[r];
return t[r] - t[l-1];
};
auto test = [&](int num) {
for (int i = 0; i + num <= n; i++) {
auto get = [&](int n) {
return -getv(i, i + n - 1) + getv(i + n, i + num - 1) - 1ll * a[i + n - 1] * (num - n - n);
};
if (min(get(num / 2), get((num + 1) / 2)) <= b) return true;
}
return false;
};
while (l <= r) {
int mid = l + r >> 1;
if (test(mid)) l = mid + 1;
else r = mid - 1;
}
return r;
}
컴파일 시 표준 에러 (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... |