Submission #97090

# Submission time Handle Problem Language Result Execution time Memory
97090 2019-02-13T19:35:21 Z dalgerok Hacker (BOI15_hac) C++14
100 / 100
80 ms 15608 KB
#include<bits/stdc++.h>
using namespace std;


const int N = 15e5 + 5;



int n, m, sum, a[N], b[N];




int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        a[i + n] = a[i + 2 * n] = a[i];
    }
    m = (n + 1) / 2;
    sum = 0;
    for(int i = 1; i <= 3 * n; i++){
        sum += a[i];
        if(i > m){
            sum -= a[i - m];
        }
        b[i] = sum;
    }
    deque < int > q;
    int ans = 0;
    for(int i = 1; i <= 3 * n; i++){
        while(!q.empty() && b[q.back()] >= b[i]){
            q.pop_back();
        }
        q.push_back(i);
        if(q.front() + m <= i){
            q.pop_front();
        }
        ans = max(ans, b[q.front()]);
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 3 ms 392 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 3 ms 392 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 ms 512 KB Output is correct
24 Correct 3 ms 512 KB Output is correct
25 Correct 3 ms 512 KB Output is correct
26 Correct 4 ms 512 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 512 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 4 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 4 ms 512 KB Output is correct
4 Correct 15 ms 2744 KB Output is correct
5 Correct 31 ms 6272 KB Output is correct
6 Correct 39 ms 7800 KB Output is correct
7 Correct 47 ms 9464 KB Output is correct
8 Correct 80 ms 15352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 3 ms 392 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 ms 512 KB Output is correct
24 Correct 3 ms 512 KB Output is correct
25 Correct 3 ms 512 KB Output is correct
26 Correct 4 ms 512 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 512 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 4 ms 444 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 4 ms 512 KB Output is correct
35 Correct 15 ms 2744 KB Output is correct
36 Correct 31 ms 6272 KB Output is correct
37 Correct 39 ms 7800 KB Output is correct
38 Correct 47 ms 9464 KB Output is correct
39 Correct 80 ms 15352 KB Output is correct
40 Correct 4 ms 640 KB Output is correct
41 Correct 6 ms 1024 KB Output is correct
42 Correct 7 ms 1280 KB Output is correct
43 Correct 33 ms 6468 KB Output is correct
44 Correct 78 ms 15288 KB Output is correct
45 Correct 18 ms 3328 KB Output is correct
46 Correct 53 ms 9308 KB Output is correct
47 Correct 78 ms 15224 KB Output is correct
48 Correct 78 ms 15608 KB Output is correct
49 Correct 69 ms 14716 KB Output is correct
50 Correct 63 ms 14724 KB Output is correct