답안 #40735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40735 2018-02-07T16:53:17 Z bogdan10bos Bali Sculptures (APIO15_sculpture) C++14
50 / 100
118 ms 748 KB
#include <bits/stdc++.h>

using namespace std;

//#define FILE_IO

typedef long long LL;

int N, A, B;
int v[2005];
LL s[2005];
LL ans;
int dp1[2005];

bool can(int b)
{
    LL pw = (1LL << b);
    if(A == 1)
    {
        dp1[0] = 0;
        for(int i = 1; i <= N; i++)
        {
            dp1[i] = N + 1;
            for(int j = 0; j < i; j++)
                if( ( (s[i] - s[j]) & (~ans) ) < pw )
                    dp1[i] = min(dp1[i], dp1[j] + 1);
        }
        return (dp1[N] <= B);
    }
    return true;
}

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d%d", &N, &A, &B);
    for(int i = 1; i <= N; i++) scanf("%d", &v[i]), s[i] = s[i - 1] + v[i];

    ans = 0;
    for(int b = 41; b >= 0; b--)
        if( !can(b) )
            ans ^= (1LL << b);

    printf("%lld\n", ans);

    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:40:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &N, &A, &B);
                                ^
sculpture.cpp:41:75: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= N; i++) scanf("%d", &v[i]), s[i] = s[i - 1] + v[i];
                                                                           ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 1 ms 424 KB Output is correct
4 Correct 1 ms 424 KB Output is correct
5 Correct 1 ms 440 KB Output is correct
6 Correct 1 ms 472 KB Output is correct
7 Correct 1 ms 528 KB Output is correct
8 Correct 1 ms 544 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 2 ms 600 KB Output is correct
14 Incorrect 2 ms 612 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 620 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 620 KB Output is correct
8 Correct 2 ms 620 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Correct 2 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 1 ms 620 KB Output is correct
13 Correct 2 ms 620 KB Output is correct
14 Incorrect 1 ms 744 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 744 KB Output is correct
2 Correct 2 ms 744 KB Output is correct
3 Correct 1 ms 744 KB Output is correct
4 Correct 1 ms 744 KB Output is correct
5 Correct 2 ms 744 KB Output is correct
6 Correct 1 ms 744 KB Output is correct
7 Correct 1 ms 744 KB Output is correct
8 Correct 1 ms 744 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 1 ms 744 KB Output is correct
11 Correct 1 ms 744 KB Output is correct
12 Correct 2 ms 744 KB Output is correct
13 Correct 2 ms 744 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 2 ms 744 KB Output is correct
17 Correct 2 ms 744 KB Output is correct
18 Correct 2 ms 744 KB Output is correct
19 Correct 2 ms 744 KB Output is correct
20 Correct 2 ms 744 KB Output is correct
21 Correct 2 ms 744 KB Output is correct
22 Correct 2 ms 744 KB Output is correct
23 Correct 2 ms 744 KB Output is correct
24 Correct 2 ms 744 KB Output is correct
25 Correct 2 ms 744 KB Output is correct
26 Correct 2 ms 744 KB Output is correct
27 Correct 2 ms 744 KB Output is correct
28 Correct 2 ms 744 KB Output is correct
29 Correct 2 ms 744 KB Output is correct
30 Correct 2 ms 744 KB Output is correct
31 Correct 2 ms 744 KB Output is correct
32 Correct 2 ms 744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 744 KB Output is correct
2 Correct 2 ms 744 KB Output is correct
3 Correct 1 ms 744 KB Output is correct
4 Correct 1 ms 744 KB Output is correct
5 Correct 1 ms 744 KB Output is correct
6 Correct 2 ms 744 KB Output is correct
7 Correct 1 ms 744 KB Output is correct
8 Correct 2 ms 744 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 2 ms 744 KB Output is correct
11 Correct 2 ms 744 KB Output is correct
12 Correct 2 ms 744 KB Output is correct
13 Correct 1 ms 744 KB Output is correct
14 Incorrect 1 ms 744 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 744 KB Output is correct
2 Correct 2 ms 744 KB Output is correct
3 Correct 2 ms 744 KB Output is correct
4 Correct 2 ms 744 KB Output is correct
5 Correct 1 ms 744 KB Output is correct
6 Correct 2 ms 744 KB Output is correct
7 Correct 2 ms 744 KB Output is correct
8 Correct 1 ms 744 KB Output is correct
9 Correct 1 ms 744 KB Output is correct
10 Correct 1 ms 744 KB Output is correct
11 Correct 1 ms 744 KB Output is correct
12 Correct 2 ms 744 KB Output is correct
13 Correct 2 ms 744 KB Output is correct
14 Correct 1 ms 744 KB Output is correct
15 Correct 1 ms 744 KB Output is correct
16 Correct 1 ms 744 KB Output is correct
17 Correct 2 ms 744 KB Output is correct
18 Correct 2 ms 744 KB Output is correct
19 Correct 1 ms 744 KB Output is correct
20 Correct 1 ms 744 KB Output is correct
21 Correct 1 ms 744 KB Output is correct
22 Correct 1 ms 744 KB Output is correct
23 Correct 2 ms 744 KB Output is correct
24 Correct 1 ms 744 KB Output is correct
25 Correct 2 ms 744 KB Output is correct
26 Correct 1 ms 744 KB Output is correct
27 Correct 1 ms 744 KB Output is correct
28 Correct 2 ms 744 KB Output is correct
29 Correct 2 ms 744 KB Output is correct
30 Correct 2 ms 744 KB Output is correct
31 Correct 2 ms 744 KB Output is correct
32 Correct 2 ms 744 KB Output is correct
33 Correct 2 ms 744 KB Output is correct
34 Correct 2 ms 744 KB Output is correct
35 Correct 2 ms 744 KB Output is correct
36 Correct 2 ms 744 KB Output is correct
37 Correct 2 ms 744 KB Output is correct
38 Correct 2 ms 744 KB Output is correct
39 Correct 2 ms 744 KB Output is correct
40 Correct 2 ms 744 KB Output is correct
41 Correct 2 ms 744 KB Output is correct
42 Correct 2 ms 744 KB Output is correct
43 Correct 2 ms 744 KB Output is correct
44 Correct 2 ms 744 KB Output is correct
45 Correct 2 ms 744 KB Output is correct
46 Correct 2 ms 744 KB Output is correct
47 Correct 2 ms 744 KB Output is correct
48 Correct 2 ms 744 KB Output is correct
49 Correct 2 ms 744 KB Output is correct
50 Correct 2 ms 744 KB Output is correct
51 Correct 2 ms 744 KB Output is correct
52 Correct 11 ms 744 KB Output is correct
53 Correct 17 ms 744 KB Output is correct
54 Correct 31 ms 744 KB Output is correct
55 Correct 28 ms 744 KB Output is correct
56 Correct 101 ms 744 KB Output is correct
57 Correct 100 ms 744 KB Output is correct
58 Correct 100 ms 748 KB Output is correct
59 Correct 95 ms 748 KB Output is correct
60 Correct 105 ms 748 KB Output is correct
61 Correct 2 ms 748 KB Output is correct
62 Correct 19 ms 748 KB Output is correct
63 Correct 38 ms 748 KB Output is correct
64 Correct 32 ms 748 KB Output is correct
65 Correct 52 ms 748 KB Output is correct
66 Correct 75 ms 748 KB Output is correct
67 Correct 118 ms 748 KB Output is correct
68 Correct 103 ms 748 KB Output is correct
69 Correct 96 ms 748 KB Output is correct