# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1077137 |
2024-08-27T01:34:44 Z |
juicy |
Rice Hub (IOI11_ricehub) |
C++17 |
|
3 ms |
856 KB |
#include "ricehub.h"
#include <bits/stdc++.h>
int besthub(int n, int L, int x[], long long b) {
std::vector<long long> a(n), pf(n);
for (int i = 0; i < n; ++i) {
a[i] = (i ? a[i - 1] : 0) + x[i];
pf[i] = (i ? pf[i - 1] : 0) + a[i];
}
auto qry = [&](int l, int r) {
int md = (l + r) / 2;
return (md - l + 1) * a[md] - pf[md] + (l ? pf[l - 1] : 0LL) + pf[r] - pf[md] - (r - md) * a[md + 1];
};
int res = 0;
for (int i = 0, j = 0; i < n; ++i) {
while (qry(j, i) > b) {
++j;
}
res = std::max(res, i - j + 1);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |