# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527876 | 2022-02-18T15:03:33 Z | rainboy | 케이크 (JOI13_cake) | C | 1500 ms | 1644 KB |
#include <stdio.h> #define N 300000 int main() { static int aa[N]; int n, i, l, r, k; long long sum; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &aa[i]); for (i = 0; i < n; i++) { l = r = i, k = 1, sum = aa[i]; while (r - l + 1 < n) if (aa[(l - 1 + n) % n] > aa[(r + 1) % n]) { l--; if (k++ % 2 == 0) sum += aa[(l + n) % n]; } else { r++; if (k++ % 2 == 0) sum += aa[r % n]; } printf("%lld\n", sum); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 239 ms | 400 KB | Output is correct |
2 | Correct | 247 ms | 360 KB | Output is correct |
3 | Correct | 231 ms | 456 KB | Output is correct |
4 | Correct | 239 ms | 356 KB | Output is correct |
5 | Correct | 233 ms | 404 KB | Output is correct |
6 | Correct | 232 ms | 632 KB | Output is correct |
7 | Correct | 242 ms | 336 KB | Output is correct |
8 | Correct | 230 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 208 KB | Output is correct |
10 | Correct | 0 ms | 208 KB | Output is correct |
11 | Correct | 0 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1555 ms | 1644 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |