Submission #723575

# Submission time Handle Problem Language Result Execution time Memory
723575 2023-04-14T05:33:54 Z MDSPro Hacker (BOI15_hac) C++17
40 / 100
1000 ms 1188 KB
#include "bits/stdc++.h"

using namespace std;

int main(){
    int n; cin >> n;
    vector<int> v(2*n);
    for(int i = 0,x; i < n; ++i){
        cin >> x;
        v[i] = v[i+n] = x;
    }
    
    vector<int> ans(n,1e9);
    
    int sum = 0;
    int need = (n+1)/2;
    for(int i = 0; i < 2*n; ++i){
        sum += v[i];
        if(i-need+1 >= 0) {
            // i-need+1...i
            // cerr << i << ' ' << sum << '\n';
            for(int j = i-need+1; j <= i; ++j) {
                if(j >= n) ans[j-n] = min(ans[j-n],sum);
                else ans[j] = min(ans[j],sum);
            }
            sum -= v[i-need+1];
        }
    }

    int res = 0;
    for(int i = 0; i < n; ++i){
        res = max(res,ans[i]);
    }
    cout << res;
}
# 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 7 ms 332 KB Output is correct
23 Correct 19 ms 360 KB Output is correct
24 Correct 8 ms 328 KB Output is correct
25 Correct 19 ms 340 KB Output is correct
26 Correct 19 ms 356 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 20 ms 340 KB Output is correct
31 Correct 19 ms 340 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 20 ms 352 KB Output is correct
4 Execution timed out 1088 ms 1188 KB Time limit exceeded
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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 7 ms 332 KB Output is correct
23 Correct 19 ms 360 KB Output is correct
24 Correct 8 ms 328 KB Output is correct
25 Correct 19 ms 340 KB Output is correct
26 Correct 19 ms 356 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 20 ms 340 KB Output is correct
31 Correct 19 ms 340 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 20 ms 352 KB Output is correct
35 Execution timed out 1088 ms 1188 KB Time limit exceeded
36 Halted 0 ms 0 KB -