Submission #126417

# Submission time Handle Problem Language Result Execution time Memory
126417 2019-07-07T16:50:49 Z Vardanyan Hacker (BOI15_hac) C++14
0 / 100
2 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 500*1000+5;
int a[N];
int main(){
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++) cin>>a[i];
    int k = (n+1)/2;
    int ans = 0;
    for(int i = 1;i<=n;i++){
        int kk = k;
        int x,y;
        x = y = 0;
        int ind = i;
        while(kk--){
            x+=a[ind];
            if(ind+1<=n) ind++;
            else ind = 1;
        }
        kk = k;
        while(kk--){
            y+=a[ind];
            if(ind-1>=1) ind--;
            else ind = n;
        }
        x = min(x,y);
        ans = max(ans,x);
    }
    cout<<ans<<endl;
    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 504 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 -