답안 #723585

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723585 2023-04-14T05:47:57 Z Mr_Husanboy Hacker (BOI15_hac) C++17
60 / 100
182 ms 2260 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const int inf = 1e9;


void solve(){
    int n; cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i ++) cin >> p[i];
    int ans = 0;
    for(int i = 1; i < n; i ++){
        p[i] += p[i - 1];
    }
    auto get = [&](int l, int r)->int{
        if(l > r){
            return p[r] + p[n - 1] - (l ? p[l - 1] : 0);
        }
        return p[r] - (l ? p[l - 1] : 0);
    };
    int k = (n + 1) / 2;
    for(int i = 0; i < n; i ++){
        int mn = inf;
        for(int j = i; j < i + k; j ++){
            int r = j % n;
            int l = ((r - k + 1) % n + n) % n;
            mn = min(mn, get(l, r));
        }
        ans = max(ans, mn);
        if(n > 5000) break;
    }
    cout << ans;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int testcases = 1;

    while(testcases --){
        solve();
        if(testcases) cout << '\n';
        #ifdef LOCAL
        else cout << '\n';
        cout << "__________________________" << endl;
        #endif
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 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 1 ms 340 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 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 1 ms 340 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 212 KB Output is correct
21 Correct 5 ms 320 KB Output is correct
22 Correct 63 ms 340 KB Output is correct
23 Correct 179 ms 344 KB Output is correct
24 Correct 66 ms 340 KB Output is correct
25 Correct 182 ms 340 KB Output is correct
26 Correct 182 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 177 ms 460 KB Output is correct
31 Correct 170 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 174 ms 320 KB Output is correct
4 Correct 6 ms 596 KB Output is correct
5 Correct 14 ms 1108 KB Output is correct
6 Correct 19 ms 1236 KB Output is correct
7 Correct 24 ms 1492 KB Output is correct
8 Correct 36 ms 2260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 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 1 ms 340 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 212 KB Output is correct
21 Correct 5 ms 320 KB Output is correct
22 Correct 63 ms 340 KB Output is correct
23 Correct 179 ms 344 KB Output is correct
24 Correct 66 ms 340 KB Output is correct
25 Correct 182 ms 340 KB Output is correct
26 Correct 182 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 177 ms 460 KB Output is correct
31 Correct 170 ms 340 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 174 ms 320 KB Output is correct
35 Correct 6 ms 596 KB Output is correct
36 Correct 14 ms 1108 KB Output is correct
37 Correct 19 ms 1236 KB Output is correct
38 Correct 24 ms 1492 KB Output is correct
39 Correct 36 ms 2260 KB Output is correct
40 Incorrect 2 ms 340 KB Output isn't correct
41 Halted 0 ms 0 KB -