Submission #31581

# Submission time Handle Problem Language Result Execution time Memory
31581 2017-08-30T01:55:47 Z minkank Hacker (BOI15_hac) C++14
100 / 100
703 ms 25484 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 5e5 + 5;

int s[2 * N], a[2 * N], n, m[2 * N];
multiset<int> st;

int main() {
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i], a[i + n] = a[i];
    for(int i = 1; i <= 2 * n; ++i) s[i] = s[i - 1] + a[i];
    int len = (n + 1) / 2, ans = 0;
    for(int i = 1; i <= 2 * n - len + 1; ++i) m[i] = s[i + len - 1] - s[i - 1];
    for(int i = 1; i <= 2 * n - len + 1; ++i) {
        if(i > len) {
            multiset<int>::iterator it = st.find(m[i - len]);
            st.erase(it);
        }
        st.insert(m[i]);
        if(i >= len) ans = max(ans, *st.begin());
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 13736 KB Output is correct
2 Correct 0 ms 13736 KB Output is correct
3 Correct 0 ms 13736 KB Output is correct
4 Correct 0 ms 13736 KB Output is correct
5 Correct 0 ms 13736 KB Output is correct
6 Correct 0 ms 13736 KB Output is correct
7 Correct 0 ms 13736 KB Output is correct
8 Correct 0 ms 13736 KB Output is correct
9 Correct 0 ms 13736 KB Output is correct
10 Correct 0 ms 13736 KB Output is correct
11 Correct 0 ms 13736 KB Output is correct
12 Correct 0 ms 13736 KB Output is correct
13 Correct 0 ms 13736 KB Output is correct
14 Correct 0 ms 13736 KB Output is correct
15 Correct 0 ms 13736 KB Output is correct
16 Correct 0 ms 13736 KB Output is correct
17 Correct 0 ms 13736 KB Output is correct
18 Correct 0 ms 13736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 13736 KB Output is correct
2 Correct 0 ms 13736 KB Output is correct
3 Correct 0 ms 13736 KB Output is correct
4 Correct 0 ms 13736 KB Output is correct
5 Correct 0 ms 13736 KB Output is correct
6 Correct 0 ms 13736 KB Output is correct
7 Correct 0 ms 13736 KB Output is correct
8 Correct 0 ms 13736 KB Output is correct
9 Correct 0 ms 13736 KB Output is correct
10 Correct 0 ms 13736 KB Output is correct
11 Correct 0 ms 13736 KB Output is correct
12 Correct 0 ms 13736 KB Output is correct
13 Correct 0 ms 13736 KB Output is correct
14 Correct 0 ms 13736 KB Output is correct
15 Correct 0 ms 13736 KB Output is correct
16 Correct 0 ms 13736 KB Output is correct
17 Correct 0 ms 13736 KB Output is correct
18 Correct 0 ms 13736 KB Output is correct
19 Correct 0 ms 13736 KB Output is correct
20 Correct 0 ms 13736 KB Output is correct
21 Correct 0 ms 13736 KB Output is correct
22 Correct 0 ms 13868 KB Output is correct
23 Correct 3 ms 13868 KB Output is correct
24 Correct 0 ms 13868 KB Output is correct
25 Correct 3 ms 13868 KB Output is correct
26 Correct 3 ms 13868 KB Output is correct
27 Correct 0 ms 13736 KB Output is correct
28 Correct 0 ms 13736 KB Output is correct
29 Correct 0 ms 13736 KB Output is correct
30 Correct 3 ms 13868 KB Output is correct
31 Correct 3 ms 13868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 13736 KB Output is correct
2 Correct 0 ms 13736 KB Output is correct
3 Correct 3 ms 13868 KB Output is correct
4 Correct 59 ms 15584 KB Output is correct
5 Correct 206 ms 18488 KB Output is correct
6 Correct 279 ms 19676 KB Output is correct
7 Correct 316 ms 20732 KB Output is correct
8 Correct 679 ms 25484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 13736 KB Output is correct
2 Correct 0 ms 13736 KB Output is correct
3 Correct 0 ms 13736 KB Output is correct
4 Correct 0 ms 13736 KB Output is correct
5 Correct 0 ms 13736 KB Output is correct
6 Correct 0 ms 13736 KB Output is correct
7 Correct 0 ms 13736 KB Output is correct
8 Correct 0 ms 13736 KB Output is correct
9 Correct 0 ms 13736 KB Output is correct
10 Correct 0 ms 13736 KB Output is correct
11 Correct 0 ms 13736 KB Output is correct
12 Correct 0 ms 13736 KB Output is correct
13 Correct 0 ms 13736 KB Output is correct
14 Correct 0 ms 13736 KB Output is correct
15 Correct 0 ms 13736 KB Output is correct
16 Correct 0 ms 13736 KB Output is correct
17 Correct 0 ms 13736 KB Output is correct
18 Correct 0 ms 13736 KB Output is correct
19 Correct 0 ms 13736 KB Output is correct
20 Correct 0 ms 13736 KB Output is correct
21 Correct 0 ms 13736 KB Output is correct
22 Correct 0 ms 13868 KB Output is correct
23 Correct 3 ms 13868 KB Output is correct
24 Correct 0 ms 13868 KB Output is correct
25 Correct 3 ms 13868 KB Output is correct
26 Correct 3 ms 13868 KB Output is correct
27 Correct 0 ms 13736 KB Output is correct
28 Correct 0 ms 13736 KB Output is correct
29 Correct 0 ms 13736 KB Output is correct
30 Correct 3 ms 13868 KB Output is correct
31 Correct 3 ms 13868 KB Output is correct
32 Correct 0 ms 13736 KB Output is correct
33 Correct 0 ms 13736 KB Output is correct
34 Correct 3 ms 13868 KB Output is correct
35 Correct 59 ms 15584 KB Output is correct
36 Correct 206 ms 18488 KB Output is correct
37 Correct 279 ms 19676 KB Output is correct
38 Correct 316 ms 20732 KB Output is correct
39 Correct 679 ms 25484 KB Output is correct
40 Correct 6 ms 14000 KB Output is correct
41 Correct 13 ms 14264 KB Output is correct
42 Correct 19 ms 14396 KB Output is correct
43 Correct 229 ms 18488 KB Output is correct
44 Correct 669 ms 25484 KB Output is correct
45 Correct 83 ms 16112 KB Output is correct
46 Correct 299 ms 20732 KB Output is correct
47 Correct 703 ms 25484 KB Output is correct
48 Correct 456 ms 25484 KB Output is correct
49 Correct 383 ms 25484 KB Output is correct
50 Correct 376 ms 25484 KB Output is correct