답안 #101227

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101227 2019-03-17T18:44:17 Z Leonardo_Paes Hacker (BOI15_hac) C++11
60 / 100
135 ms 4328 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 5e5+10;

int vet[MAXN], pref[MAXN];

int main(){

    int n, k, resp=0x3f3f3f3f;

    cin >> n;

    k = ceil((double)n/2);

    for(int i=1; i<=n; i++){
        cin >> vet[i];
        pref[i]=vet[i]+pref[i-1];
    }
    if(n>5000){
         for(int i=1; i<=k; i++){
            int sum=0;

            sum += pref[i];

            sum += pref[n] - pref[n-(k-i)];

            resp = min(resp,sum);
        }
    }
    else{
        resp=0;
        for(int i=1; i<=n; i++){
            int p=0x3f3f3f3f;
            for(int j=0; j<k; j++){
                int sum=0, x=i+j;

                if(x>n)x-=n;

                if(x<=k){
                    sum+=pref[x];
                    sum+= pref[n] - pref[n-(k-x)];
                }
                else{
                    sum+=pref[x] - pref[x-k];
                }
                p = min(p,sum);
            }
            resp=max(resp,p);
        }
    }
    cout << resp << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 356 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 356 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 356 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 356 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 11 ms 384 KB Output is correct
23 Correct 27 ms 384 KB Output is correct
24 Correct 11 ms 384 KB Output is correct
25 Correct 38 ms 512 KB Output is correct
26 Correct 25 ms 512 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 25 ms 384 KB Output is correct
31 Correct 26 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 41 ms 476 KB Output is correct
4 Correct 35 ms 1000 KB Output is correct
5 Correct 50 ms 2004 KB Output is correct
6 Correct 61 ms 2360 KB Output is correct
7 Correct 81 ms 2680 KB Output is correct
8 Correct 135 ms 4328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 356 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 356 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 11 ms 384 KB Output is correct
23 Correct 27 ms 384 KB Output is correct
24 Correct 11 ms 384 KB Output is correct
25 Correct 38 ms 512 KB Output is correct
26 Correct 25 ms 512 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 25 ms 384 KB Output is correct
31 Correct 26 ms 428 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 41 ms 476 KB Output is correct
35 Correct 35 ms 1000 KB Output is correct
36 Correct 50 ms 2004 KB Output is correct
37 Correct 61 ms 2360 KB Output is correct
38 Correct 81 ms 2680 KB Output is correct
39 Correct 135 ms 4328 KB Output is correct
40 Incorrect 4 ms 384 KB Output isn't correct
41 Halted 0 ms 0 KB -