Submission #103029

# Submission time Handle Problem Language Result Execution time Memory
103029 2019-03-28T19:18:40 Z pavel Hacker (BOI15_hac) C++14
0 / 100
2 ms 256 KB
#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXN = 500005;

int n;
int a[MAXN];
int sum[MAXN];

int main(){
    scanf("%d", &n);
    for(int i=0;i<n;++i) scanf("%d", &a[i]);
    for(int i=0;i<(n+1)/2;++i) sum[0]+=a[i];
    for(int i=1;i<n;++i){
        sum[i]=sum[i-1]-a[i-1]+a[((i+(n+1)/2)-1+n)%n];
    }
    int sol=-1;
    for(int i=0;i<n;++i){
        sol=max(sol, min(sum[i], sum[(i+(n+1)/2-1+n)%n]));
    }
    printf("%d", sol);
}

Compilation message

hac.cpp: In function 'int main()':
hac.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
hac.cpp:14:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;++i) scanf("%d", &a[i]);
                          ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -