# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532301 | rainboy | 도넛 (JOI14_ho_t3) | C11 | 264 ms | 712 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#define N 8000
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
int main() {
static long long aa[N + 1];
int n, i, j, k;
long long ans;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%lld", &aa[i]);
aa[i] += aa[i - 1];
}
ans = 0;
for (i = 0; i < n; i++)
for (j = i + 1, k = i + 1; k < n; k++) {
while (j < n && aa[j] - aa[i] < aa[k] - aa[j])
j++;
ans = max(ans, min(max(aa[j - 1] - aa[i], aa[k] - aa[j]), aa[n] + aa[i] - aa[k]));
}
printf("%lld\n", ans);
return 0;
}
Compilation message (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... |