# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
224590 | 2020-04-18T13:14:17 Z | my99n | Rice Hub (IOI11_ricehub) | C++14 | 9 ms | 640 KB |
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; long long s[100100]; int sum(int l, int r) { if (l == 0) return s[r]; return s[r] - s[l - 1]; } int besthub(int n, int L, int x[], long long b) { s[0] = x[0]; for (int i = 1; i < n; i++) s[i] = 0; for (int i = 1; i < n; i++) s[i] = x[i] + s[i - 1]; int l = 0, r = 0, ans = 1; for (int i = 0; i < n; i++) { int l = 0, r = n - 1; while (l < r) { int mid = (l + r) / 2; int med = (i + mid) / 2; int left = s[med] * (med - i + 1) - sum(i, med); int right = sum(med + 1, mid) - s[med] * (mid - med); if (left + right > b) r = mid; else l = mid + 1; } ans = max(ans, l - i + 1); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |