Submission #467490

# Submission time Handle Problem Language Result Execution time Memory
467490 2021-08-23T09:12:07 Z maeola Hacker (BOI15_hac) C++17
100 / 100
463 ms 43844 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int N;
int A[500069];
vector<int> W[500069];

int main() {
    ios::sync_with_stdio(0);
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int k = (N + 1) / 2;
    int b = k;
    int sum = 0;
    for (int i = 0; i < b; i++) sum += A[i];
    for (int a = 0; a < N; a++) {
        W[a].push_back(sum);
        W[b].push_back(-sum);
        sum = sum + A[b] - A[a];
        b = (b + 1) % N;
    }
    multiset<int> E;
    for (int i = N - k; i < N; i++) {
        for (int a : W[i]) if(a > 0)
            E.insert(a);
    }
    int mx = 0;
    for (int i = 0; i < N; i++) {
        for (int a : W[i]) if(a > 0)
            E.insert(a);

        for (int a : W[i]) if(a < 0)
            E.erase(E.find(-a));

        mx = max(mx, *E.begin());
    }
    cout << mx << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 12012 KB Output is correct
2 Correct 7 ms 11980 KB Output is correct
3 Correct 8 ms 11980 KB Output is correct
4 Correct 7 ms 12000 KB Output is correct
5 Correct 7 ms 11980 KB Output is correct
6 Correct 7 ms 12072 KB Output is correct
7 Correct 7 ms 11980 KB Output is correct
8 Correct 7 ms 12072 KB Output is correct
9 Correct 8 ms 11980 KB Output is correct
10 Correct 7 ms 12056 KB Output is correct
11 Correct 8 ms 11980 KB Output is correct
12 Correct 7 ms 12068 KB Output is correct
13 Correct 7 ms 12052 KB Output is correct
14 Correct 8 ms 12076 KB Output is correct
15 Correct 9 ms 11980 KB Output is correct
16 Correct 8 ms 12072 KB Output is correct
17 Correct 7 ms 11980 KB Output is correct
18 Correct 7 ms 11980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 12012 KB Output is correct
2 Correct 7 ms 11980 KB Output is correct
3 Correct 8 ms 11980 KB Output is correct
4 Correct 7 ms 12000 KB Output is correct
5 Correct 7 ms 11980 KB Output is correct
6 Correct 7 ms 12072 KB Output is correct
7 Correct 7 ms 11980 KB Output is correct
8 Correct 7 ms 12072 KB Output is correct
9 Correct 8 ms 11980 KB Output is correct
10 Correct 7 ms 12056 KB Output is correct
11 Correct 8 ms 11980 KB Output is correct
12 Correct 7 ms 12068 KB Output is correct
13 Correct 7 ms 12052 KB Output is correct
14 Correct 8 ms 12076 KB Output is correct
15 Correct 9 ms 11980 KB Output is correct
16 Correct 8 ms 12072 KB Output is correct
17 Correct 7 ms 11980 KB Output is correct
18 Correct 7 ms 11980 KB Output is correct
19 Correct 8 ms 12068 KB Output is correct
20 Correct 7 ms 12068 KB Output is correct
21 Correct 10 ms 12088 KB Output is correct
22 Correct 9 ms 12236 KB Output is correct
23 Correct 10 ms 12284 KB Output is correct
24 Correct 9 ms 12236 KB Output is correct
25 Correct 9 ms 12340 KB Output is correct
26 Correct 9 ms 12344 KB Output is correct
27 Correct 7 ms 11980 KB Output is correct
28 Correct 9 ms 11980 KB Output is correct
29 Correct 7 ms 12072 KB Output is correct
30 Correct 10 ms 12280 KB Output is correct
31 Correct 9 ms 12364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 11980 KB Output is correct
2 Correct 7 ms 12184 KB Output is correct
3 Correct 9 ms 12332 KB Output is correct
4 Correct 50 ms 17104 KB Output is correct
5 Correct 158 ms 24544 KB Output is correct
6 Correct 186 ms 27808 KB Output is correct
7 Correct 217 ms 31028 KB Output is correct
8 Correct 463 ms 43576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 12012 KB Output is correct
2 Correct 7 ms 11980 KB Output is correct
3 Correct 8 ms 11980 KB Output is correct
4 Correct 7 ms 12000 KB Output is correct
5 Correct 7 ms 11980 KB Output is correct
6 Correct 7 ms 12072 KB Output is correct
7 Correct 7 ms 11980 KB Output is correct
8 Correct 7 ms 12072 KB Output is correct
9 Correct 8 ms 11980 KB Output is correct
10 Correct 7 ms 12056 KB Output is correct
11 Correct 8 ms 11980 KB Output is correct
12 Correct 7 ms 12068 KB Output is correct
13 Correct 7 ms 12052 KB Output is correct
14 Correct 8 ms 12076 KB Output is correct
15 Correct 9 ms 11980 KB Output is correct
16 Correct 8 ms 12072 KB Output is correct
17 Correct 7 ms 11980 KB Output is correct
18 Correct 7 ms 11980 KB Output is correct
19 Correct 8 ms 12068 KB Output is correct
20 Correct 7 ms 12068 KB Output is correct
21 Correct 10 ms 12088 KB Output is correct
22 Correct 9 ms 12236 KB Output is correct
23 Correct 10 ms 12284 KB Output is correct
24 Correct 9 ms 12236 KB Output is correct
25 Correct 9 ms 12340 KB Output is correct
26 Correct 9 ms 12344 KB Output is correct
27 Correct 7 ms 11980 KB Output is correct
28 Correct 9 ms 11980 KB Output is correct
29 Correct 7 ms 12072 KB Output is correct
30 Correct 10 ms 12280 KB Output is correct
31 Correct 9 ms 12364 KB Output is correct
32 Correct 7 ms 11980 KB Output is correct
33 Correct 7 ms 12184 KB Output is correct
34 Correct 9 ms 12332 KB Output is correct
35 Correct 50 ms 17104 KB Output is correct
36 Correct 158 ms 24544 KB Output is correct
37 Correct 186 ms 27808 KB Output is correct
38 Correct 217 ms 31028 KB Output is correct
39 Correct 463 ms 43576 KB Output is correct
40 Correct 12 ms 12620 KB Output is correct
41 Correct 22 ms 13296 KB Output is correct
42 Correct 23 ms 13852 KB Output is correct
43 Correct 139 ms 24580 KB Output is correct
44 Correct 410 ms 43572 KB Output is correct
45 Correct 68 ms 18244 KB Output is correct
46 Correct 200 ms 30940 KB Output is correct
47 Correct 396 ms 43568 KB Output is correct
48 Correct 360 ms 43844 KB Output is correct
49 Correct 304 ms 42932 KB Output is correct
50 Correct 331 ms 43016 KB Output is correct