Submission #48383

# Submission time Handle Problem Language Result Execution time Memory
48383 2018-05-12T12:45:21 Z someone_aa Hacker (BOI15_hac) C++17
0 / 100
2 ms 568 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 100100;
ll pref[2*maxn], n;
ll arr[maxn], result[maxn];

ll get_sum(int i, int j) {
    return pref[j] - pref[i-1];
}

int main() {
    cin>>n;
    for(int i=1;i<=n;i++) {
        result[i] = LLONG_MAX;
        cin>>arr[i];
    }

    for(int i=1;i<=2*n;i++) {
        pref[i] = pref[i-1];
        if(i <= n) pref[i] += arr[i];
        else pref[i] += arr[i-n];
    }

    int x = n / 2 + n % 2;

    for(int i=1;i<=n;i++) {
        result[i] = min(result[i], get_sum(i, (i+x)-1));
    }
    for(int i=n+1;i<=2*n;i++) {
        result[i-n] = min(result[i-n], get_sum((i-x)+1, i));
    }


    ll final_result = LLONG_MIN;
    for(int i=1;i<=n;i++) {
        final_result = max(final_result, result[i]);
    }
    cout<<final_result<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 564 KB Output is correct
2 Incorrect 2 ms 568 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -