Submission #723719

# Submission time Handle Problem Language Result Execution time Memory
723719 2023-04-14T08:16:43 Z kas_s Hacker (BOI15_hac) C++17
40 / 100
195 ms 980 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int N;
    cin >> N;
    vector<int> a(N);
    long long s = 0;
    for (int &v: a) {
        cin >> v;
        s += v;
    }
    if (N <= 5000) {
        long long res = 0;
        for (int i = 0; i < N; i++) {
            long long window = 0;
            int len = N / 2;
            for (int j = i+1; j < i + len + 1; j++) window += a[j % N];
            long long curr = s - window;
            for (int r = i + len + 1; r % N != i; r++) {
                window += a[r % N];
                window -= a[(r - len) % N];
                curr = min(curr, s - window);
            }
            res = max(res, curr);
        }
        cout << res;
        return 0;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 8 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 64 ms 340 KB Output is correct
23 Correct 185 ms 340 KB Output is correct
24 Correct 64 ms 328 KB Output is correct
25 Correct 185 ms 384 KB Output is correct
26 Correct 195 ms 340 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 175 ms 340 KB Output is correct
31 Correct 180 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 175 ms 340 KB Output is correct
4 Incorrect 6 ms 980 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 8 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 64 ms 340 KB Output is correct
23 Correct 185 ms 340 KB Output is correct
24 Correct 64 ms 328 KB Output is correct
25 Correct 185 ms 384 KB Output is correct
26 Correct 195 ms 340 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 175 ms 340 KB Output is correct
31 Correct 180 ms 332 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 2 ms 212 KB Output is correct
34 Correct 175 ms 340 KB Output is correct
35 Incorrect 6 ms 980 KB Output isn't correct
36 Halted 0 ms 0 KB -