# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
55139 | 2018-07-06T06:15:42 Z | 강태규(#1525) | None (JOI14_ho_t3) | C++11 | 91 ms | 3452 KB |
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_map> #include <functional> #include <cstring> #include <cmath> #include <ctime> #include <cstdlib> using namespace std; typedef long long llong; typedef long double ld; typedef pair<int, int> pii; typedef pair<llong, llong> pll; int n; int a[100001]; llong sum[300001]; int check(llong x) { for (int i = 0, j = 0, k = 0; i < n; ++i) { while (j <= 3 * n && sum[j] - sum[i] < x) ++j; while (k <= 3 * n && sum[k] - sum[j] < x) ++k; if (sum[k] - sum[j] < sum[j] - sum[i]) continue; if (sum[n] - (sum[k] - sum[i]) < sum[j] - sum[i]) continue; return 1; } return 0; } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", a + i); sum[i] = sum[i - 1] + a[i]; } for (int i = 1; i <= n; ++i) { sum[i + n] = sum[i] + sum[n]; sum[i + n + n] = sum[i] + sum[n] + sum[n]; } llong s = 0, e = sum[n] / 3; while (s < e) { llong m = (s + e + 1) / 2; if (check(m)) s = m; else e = m - 1; } printf("%lld\n", s); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 320 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 584 KB | Output is correct |
5 | Correct | 2 ms | 584 KB | Output is correct |
6 | Correct | 2 ms | 584 KB | Output is correct |
7 | Correct | 2 ms | 584 KB | Output is correct |
8 | Correct | 2 ms | 584 KB | Output is correct |
9 | Correct | 2 ms | 584 KB | Output is correct |
10 | Correct | 2 ms | 584 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 320 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 584 KB | Output is correct |
5 | Correct | 2 ms | 584 KB | Output is correct |
6 | Correct | 2 ms | 584 KB | Output is correct |
7 | Correct | 2 ms | 584 KB | Output is correct |
8 | Correct | 2 ms | 584 KB | Output is correct |
9 | Correct | 2 ms | 584 KB | Output is correct |
10 | Correct | 2 ms | 584 KB | Output is correct |
11 | Correct | 3 ms | 584 KB | Output is correct |
12 | Correct | 3 ms | 584 KB | Output is correct |
13 | Correct | 3 ms | 584 KB | Output is correct |
14 | Correct | 2 ms | 584 KB | Output is correct |
15 | Correct | 2 ms | 584 KB | Output is correct |
16 | Correct | 2 ms | 704 KB | Output is correct |
17 | Correct | 2 ms | 704 KB | Output is correct |
18 | Correct | 2 ms | 704 KB | Output is correct |
19 | Correct | 3 ms | 704 KB | Output is correct |
20 | Correct | 3 ms | 704 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 320 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 584 KB | Output is correct |
5 | Correct | 2 ms | 584 KB | Output is correct |
6 | Correct | 2 ms | 584 KB | Output is correct |
7 | Correct | 2 ms | 584 KB | Output is correct |
8 | Correct | 2 ms | 584 KB | Output is correct |
9 | Correct | 2 ms | 584 KB | Output is correct |
10 | Correct | 2 ms | 584 KB | Output is correct |
11 | Correct | 3 ms | 584 KB | Output is correct |
12 | Correct | 3 ms | 584 KB | Output is correct |
13 | Correct | 3 ms | 584 KB | Output is correct |
14 | Correct | 2 ms | 584 KB | Output is correct |
15 | Correct | 2 ms | 584 KB | Output is correct |
16 | Correct | 2 ms | 704 KB | Output is correct |
17 | Correct | 2 ms | 704 KB | Output is correct |
18 | Correct | 2 ms | 704 KB | Output is correct |
19 | Correct | 3 ms | 704 KB | Output is correct |
20 | Correct | 3 ms | 704 KB | Output is correct |
21 | Correct | 5 ms | 764 KB | Output is correct |
22 | Correct | 4 ms | 764 KB | Output is correct |
23 | Correct | 7 ms | 764 KB | Output is correct |
24 | Correct | 5 ms | 764 KB | Output is correct |
25 | Correct | 7 ms | 892 KB | Output is correct |
26 | Correct | 7 ms | 892 KB | Output is correct |
27 | Correct | 8 ms | 892 KB | Output is correct |
28 | Correct | 7 ms | 892 KB | Output is correct |
29 | Correct | 7 ms | 892 KB | Output is correct |
30 | Correct | 8 ms | 892 KB | Output is correct |
31 | Correct | 4 ms | 892 KB | Output is correct |
32 | Correct | 4 ms | 892 KB | Output is correct |
33 | Correct | 5 ms | 892 KB | Output is correct |
34 | Correct | 4 ms | 892 KB | Output is correct |
35 | Correct | 4 ms | 892 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 320 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 508 KB | Output is correct |
4 | Correct | 2 ms | 584 KB | Output is correct |
5 | Correct | 2 ms | 584 KB | Output is correct |
6 | Correct | 2 ms | 584 KB | Output is correct |
7 | Correct | 2 ms | 584 KB | Output is correct |
8 | Correct | 2 ms | 584 KB | Output is correct |
9 | Correct | 2 ms | 584 KB | Output is correct |
10 | Correct | 2 ms | 584 KB | Output is correct |
11 | Correct | 3 ms | 584 KB | Output is correct |
12 | Correct | 3 ms | 584 KB | Output is correct |
13 | Correct | 3 ms | 584 KB | Output is correct |
14 | Correct | 2 ms | 584 KB | Output is correct |
15 | Correct | 2 ms | 584 KB | Output is correct |
16 | Correct | 2 ms | 704 KB | Output is correct |
17 | Correct | 2 ms | 704 KB | Output is correct |
18 | Correct | 2 ms | 704 KB | Output is correct |
19 | Correct | 3 ms | 704 KB | Output is correct |
20 | Correct | 3 ms | 704 KB | Output is correct |
21 | Correct | 5 ms | 764 KB | Output is correct |
22 | Correct | 4 ms | 764 KB | Output is correct |
23 | Correct | 7 ms | 764 KB | Output is correct |
24 | Correct | 5 ms | 764 KB | Output is correct |
25 | Correct | 7 ms | 892 KB | Output is correct |
26 | Correct | 7 ms | 892 KB | Output is correct |
27 | Correct | 8 ms | 892 KB | Output is correct |
28 | Correct | 7 ms | 892 KB | Output is correct |
29 | Correct | 7 ms | 892 KB | Output is correct |
30 | Correct | 8 ms | 892 KB | Output is correct |
31 | Correct | 4 ms | 892 KB | Output is correct |
32 | Correct | 4 ms | 892 KB | Output is correct |
33 | Correct | 5 ms | 892 KB | Output is correct |
34 | Correct | 4 ms | 892 KB | Output is correct |
35 | Correct | 4 ms | 892 KB | Output is correct |
36 | Correct | 72 ms | 3324 KB | Output is correct |
37 | Correct | 91 ms | 3356 KB | Output is correct |
38 | Correct | 73 ms | 3356 KB | Output is correct |
39 | Correct | 67 ms | 3360 KB | Output is correct |
40 | Correct | 55 ms | 3360 KB | Output is correct |
41 | Correct | 64 ms | 3452 KB | Output is correct |
42 | Correct | 75 ms | 3452 KB | Output is correct |
43 | Correct | 76 ms | 3452 KB | Output is correct |
44 | Correct | 76 ms | 3452 KB | Output is correct |
45 | Correct | 48 ms | 3452 KB | Output is correct |
46 | Correct | 29 ms | 3452 KB | Output is correct |
47 | Correct | 26 ms | 3452 KB | Output is correct |
48 | Correct | 27 ms | 3452 KB | Output is correct |