Submission #45832

# Submission time Handle Problem Language Result Execution time Memory
45832 2018-04-16T08:46:15 Z Extazy Bali Sculptures (APIO15_sculpture) C++17
21 / 100
7 ms 1380 KB
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

const int N = 2007;
const long long INF = 1000000000000007;

int n,a,b;
long long arr[N],ans;
bool used[N][N];
long long state[N][N];

long long recurse(int pos, int groups) {
    if(pos>n) {
        if(groups==0) return 0;
        return INF;
    }

    if(used[pos][groups]) return state[pos][groups];

    long long ans=INF;
    int i;

    for(i=pos;i<=n;i++) {
        ans=min(ans,(arr[i]-arr[pos-1])|recurse(i+1,groups-1));
    }

    used[pos][groups]=true;
    return state[pos][groups]=ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i;

    scanf("%d %d %d", &n, &a, &b);
    for(i=1;i<=n;i++) {
        scanf("%lld", &arr[i]);
        arr[i]+=arr[i-1];
    }

    ans=INF;
    for(i=a;i<=b;i++) {
        ans=min(ans,recurse(1,i));
    }

    printf("%lld\n", ans);
    
    return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:38:10: 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:40:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &arr[i]);
         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 576 KB Output is correct
6 Correct 2 ms 628 KB Output is correct
7 Correct 2 ms 688 KB Output is correct
8 Correct 2 ms 712 KB Output is correct
9 Correct 2 ms 748 KB Output is correct
10 Correct 2 ms 852 KB Output is correct
11 Correct 2 ms 852 KB Output is correct
12 Correct 2 ms 852 KB Output is correct
13 Correct 3 ms 852 KB Output is correct
14 Correct 2 ms 852 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 2 ms 852 KB Output is correct
17 Correct 2 ms 852 KB Output is correct
18 Correct 2 ms 852 KB Output is correct
19 Correct 2 ms 852 KB Output is correct
20 Correct 2 ms 852 KB Output is correct
21 Incorrect 2 ms 852 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 852 KB Output is correct
2 Correct 2 ms 852 KB Output is correct
3 Correct 2 ms 852 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 2 ms 852 KB Output is correct
6 Correct 2 ms 852 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 2 ms 852 KB Output is correct
10 Correct 2 ms 852 KB Output is correct
11 Correct 2 ms 852 KB Output is correct
12 Correct 2 ms 852 KB Output is correct
13 Correct 2 ms 852 KB Output is correct
14 Correct 2 ms 852 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 2 ms 852 KB Output is correct
17 Correct 2 ms 852 KB Output is correct
18 Correct 2 ms 852 KB Output is correct
19 Correct 2 ms 852 KB Output is correct
20 Correct 2 ms 852 KB Output is correct
21 Incorrect 2 ms 852 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 852 KB Output is correct
2 Correct 2 ms 852 KB Output is correct
3 Correct 2 ms 852 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 2 ms 852 KB Output is correct
6 Correct 2 ms 852 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 2 ms 852 KB Output is correct
10 Correct 2 ms 852 KB Output is correct
11 Correct 2 ms 852 KB Output is correct
12 Correct 2 ms 852 KB Output is correct
13 Correct 2 ms 852 KB Output is correct
14 Correct 2 ms 852 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 3 ms 892 KB Output is correct
17 Correct 2 ms 896 KB Output is correct
18 Correct 2 ms 896 KB Output is correct
19 Correct 2 ms 932 KB Output is correct
20 Correct 2 ms 932 KB Output is correct
21 Correct 3 ms 932 KB Output is correct
22 Correct 3 ms 932 KB Output is correct
23 Correct 3 ms 964 KB Output is correct
24 Correct 2 ms 964 KB Output is correct
25 Correct 2 ms 1020 KB Output is correct
26 Correct 3 ms 1148 KB Output is correct
27 Correct 4 ms 1380 KB Output is correct
28 Correct 7 ms 1380 KB Output is correct
29 Correct 6 ms 1380 KB Output is correct
30 Correct 3 ms 1380 KB Output is correct
31 Correct 5 ms 1380 KB Output is correct
32 Correct 6 ms 1380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1380 KB Output is correct
2 Correct 2 ms 1380 KB Output is correct
3 Correct 2 ms 1380 KB Output is correct
4 Correct 2 ms 1380 KB Output is correct
5 Correct 2 ms 1380 KB Output is correct
6 Correct 2 ms 1380 KB Output is correct
7 Correct 2 ms 1380 KB Output is correct
8 Correct 2 ms 1380 KB Output is correct
9 Correct 2 ms 1380 KB Output is correct
10 Correct 2 ms 1380 KB Output is correct
11 Correct 2 ms 1380 KB Output is correct
12 Correct 2 ms 1380 KB Output is correct
13 Correct 2 ms 1380 KB Output is correct
14 Correct 2 ms 1380 KB Output is correct
15 Correct 2 ms 1380 KB Output is correct
16 Correct 2 ms 1380 KB Output is correct
17 Correct 2 ms 1380 KB Output is correct
18 Correct 2 ms 1380 KB Output is correct
19 Correct 2 ms 1380 KB Output is correct
20 Correct 2 ms 1380 KB Output is correct
21 Incorrect 2 ms 1380 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1380 KB Output is correct
2 Correct 2 ms 1380 KB Output is correct
3 Correct 2 ms 1380 KB Output is correct
4 Correct 2 ms 1380 KB Output is correct
5 Correct 2 ms 1380 KB Output is correct
6 Correct 2 ms 1380 KB Output is correct
7 Correct 2 ms 1380 KB Output is correct
8 Correct 2 ms 1380 KB Output is correct
9 Correct 2 ms 1380 KB Output is correct
10 Correct 2 ms 1380 KB Output is correct
11 Correct 2 ms 1380 KB Output is correct
12 Correct 2 ms 1380 KB Output is correct
13 Correct 2 ms 1380 KB Output is correct
14 Correct 2 ms 1380 KB Output is correct
15 Correct 2 ms 1380 KB Output is correct
16 Correct 2 ms 1380 KB Output is correct
17 Correct 2 ms 1380 KB Output is correct
18 Correct 2 ms 1380 KB Output is correct
19 Correct 2 ms 1380 KB Output is correct
20 Correct 3 ms 1380 KB Output is correct
21 Correct 2 ms 1380 KB Output is correct
22 Correct 2 ms 1380 KB Output is correct
23 Correct 2 ms 1380 KB Output is correct
24 Correct 2 ms 1380 KB Output is correct
25 Correct 2 ms 1380 KB Output is correct
26 Correct 2 ms 1380 KB Output is correct
27 Correct 2 ms 1380 KB Output is correct
28 Correct 2 ms 1380 KB Output is correct
29 Correct 3 ms 1380 KB Output is correct
30 Correct 2 ms 1380 KB Output is correct
31 Correct 3 ms 1380 KB Output is correct
32 Correct 2 ms 1380 KB Output is correct
33 Correct 2 ms 1380 KB Output is correct
34 Correct 3 ms 1380 KB Output is correct
35 Correct 2 ms 1380 KB Output is correct
36 Correct 4 ms 1380 KB Output is correct
37 Correct 6 ms 1380 KB Output is correct
38 Correct 6 ms 1380 KB Output is correct
39 Correct 6 ms 1380 KB Output is correct
40 Correct 3 ms 1380 KB Output is correct
41 Correct 6 ms 1380 KB Output is correct
42 Correct 5 ms 1380 KB Output is correct
43 Incorrect 2 ms 1380 KB Output isn't correct
44 Halted 0 ms 0 KB -