답안 #103037

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
103037 2019-03-28T19:51:22 Z pavel Hacker (BOI15_hac) C++14
20 / 100
666 ms 16120 KB
#include <cstdio>
#include <algorithm>
#include <set>

using namespace std;

const int MAXN = 500005;

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

int main(){
    scanf("%d", &n);
    k=(n+1)/2;
    for(int i=0;i<n;++i) scanf("%d", &a[i]);
    for(int i=0;i<k;++i) sum[0]+=a[i];
    for(int i=1;i<n;++i){
        sum[i]=sum[i-1]-a[i-1]+a[(i+k-1+n)%n];
    }
    multiset<int> s;
    for(int i=0;i<k;++i) s.insert(sum[i]);
    int sol=*s.begin();
    bool x = true;
    for(int i=k;x || i!=k;i=(i+1)%n){
        x=false;
        s.insert(sum[i]);
        s.erase(sum[(i-k+n)%n]);
        sol=max(sol, *s.begin());
    }
    printf("%d", sol);
}

Compilation message

hac.cpp: In function 'int main()':
hac.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
hac.cpp:16: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]);
                          ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 3 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 3 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 356 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Incorrect 4 ms 512 KB Output isn't correct
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 412 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 51 ms 2808 KB Output is correct
5 Correct 177 ms 6612 KB Output is correct
6 Correct 227 ms 8340 KB Output is correct
7 Correct 288 ms 9848 KB Output is correct
8 Incorrect 666 ms 16120 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 3 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 356 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Incorrect 4 ms 512 KB Output isn't correct
24 Halted 0 ms 0 KB -