| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 378060 | MilosMilutinovic | Rice Hub (IOI11_ricehub) | C++14 | 29 ms | 2688 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int n, int len, int* a, long long b) {
vector<long long> pref(n);
for (int i = 0; i < n; i++) {
if (i == 0) {
pref[i] = a[i];
} else {
pref[i] = pref[i - 1] + a[i];
}
}
auto Can = [&](int l, int r) {
int mid = l + r >> 1;
long long ll = (long long) a[mid] * (mid - l + 1) - (pref[mid] - (l == 0 ? 0LL: pref[l - 1]));
long long rr = pref[r] - pref[mid] - (long long) a[mid] * (r - mid);
return ll + rr <= b;
};
int ans = 1;
for (int i = 0; i < n; i++) {
int bot = i, top = n - 1, mx = 0;
while (bot <= top) {
int mid = bot + top >> 1;
if (Can(i, mid)) {
mx = mid - i + 1;
bot = mid + 1;
} else {
top = mid - 1;
}
}
ans = max(ans, mx);
}
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... | ||||
