Submission #723555

# Submission time Handle Problem Language Result Execution time Memory
723555 2023-04-14T05:04:56 Z Mr_Husanboy Hacker (BOI15_hac) C++17
0 / 100
2 ms 212 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;



void solve(){
    int n; cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i ++) cin >> v[i];
    ll ans = 0;
    int k = (n + 1) / 2;
    for(int i = 0; i < n; i ++){
        ll a = 0, b = 0;
        for(int j = 0; j < k; j ++){
            a += v[(i + j) % n];
            b += v[((i - j) % n + n) % n];
        }
        ans = max(ans, min(a,b));
    }
    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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 2 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -