Submission #207499

# Submission time Handle Problem Language Result Execution time Memory
207499 2020-03-07T16:33:10 Z DystoriaX Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 632 KB
#include <bits/stdc++.h>

using namespace std;

int n, a, b;
int y[1010];
long long pref[1010];
long long ans = 1e18, sum = 0;

void rec(int depth, int last){
    if(last > n){
        if(a <= depth && depth <= b) ans = min(ans, sum);
        return;
    } else {
        long long tp = sum;
        for(int i = last; i <= n; i++){
            sum |= (pref[i] - pref[last - 1]);
            rec(depth + 1, i + 1);
            sum = tp;
        }
    }
}

int main(){
    scanf("%d%d%d", &n, &a, &b);

    for(int i = 1; i <= n; i++) scanf("%d", &y[i]), pref[i] = pref[i - 1] + y[i];

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

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:25: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:27:51: 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", &y[i]), pref[i] = pref[i - 1] + y[i];
                                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 9 ms 256 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 9 ms 376 KB Output is correct
11 Correct 9 ms 256 KB Output is correct
12 Correct 9 ms 376 KB Output is correct
13 Correct 9 ms 376 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 9 ms 376 KB Output is correct
22 Correct 9 ms 376 KB Output is correct
23 Correct 11 ms 376 KB Output is correct
24 Correct 10 ms 376 KB Output is correct
25 Correct 9 ms 256 KB Output is correct
26 Correct 10 ms 256 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
29 Correct 5 ms 256 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 9 ms 376 KB Output is correct
32 Correct 11 ms 256 KB Output is correct
33 Correct 10 ms 256 KB Output is correct
34 Correct 10 ms 376 KB Output is correct
35 Correct 9 ms 376 KB Output is correct
36 Correct 9 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 372 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 9 ms 376 KB Output is correct
9 Correct 9 ms 256 KB Output is correct
10 Correct 9 ms 376 KB Output is correct
11 Correct 9 ms 380 KB Output is correct
12 Correct 9 ms 376 KB Output is correct
13 Correct 10 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 372 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 9 ms 376 KB Output is correct
22 Correct 9 ms 376 KB Output is correct
23 Correct 9 ms 376 KB Output is correct
24 Correct 10 ms 256 KB Output is correct
25 Correct 9 ms 376 KB Output is correct
26 Correct 9 ms 256 KB Output is correct
27 Correct 14 ms 376 KB Output is correct
28 Correct 140 ms 376 KB Output is correct
29 Execution timed out 1089 ms 256 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 5 ms 380 KB Output is correct
8 Correct 9 ms 376 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 9 ms 368 KB Output is correct
11 Correct 9 ms 256 KB Output is correct
12 Correct 9 ms 376 KB Output is correct
13 Correct 10 ms 256 KB Output is correct
14 Correct 14 ms 376 KB Output is correct
15 Correct 140 ms 376 KB Output is correct
16 Execution timed out 1093 ms 256 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 9 ms 376 KB Output is correct
9 Correct 9 ms 256 KB Output is correct
10 Correct 9 ms 256 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 9 ms 256 KB Output is correct
13 Correct 9 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 380 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 9 ms 376 KB Output is correct
22 Correct 9 ms 256 KB Output is correct
23 Correct 9 ms 376 KB Output is correct
24 Correct 9 ms 376 KB Output is correct
25 Correct 9 ms 376 KB Output is correct
26 Correct 10 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 5 ms 256 KB Output is correct
29 Correct 5 ms 376 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 9 ms 376 KB Output is correct
32 Correct 9 ms 376 KB Output is correct
33 Correct 9 ms 376 KB Output is correct
34 Correct 9 ms 256 KB Output is correct
35 Correct 9 ms 380 KB Output is correct
36 Correct 9 ms 256 KB Output is correct
37 Correct 14 ms 632 KB Output is correct
38 Correct 147 ms 376 KB Output is correct
39 Execution timed out 1087 ms 376 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 9 ms 376 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 9 ms 376 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 9 ms 376 KB Output is correct
13 Correct 9 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 7 ms 256 KB Output is correct
18 Correct 9 ms 256 KB Output is correct
19 Correct 9 ms 380 KB Output is correct
20 Correct 9 ms 376 KB Output is correct
21 Correct 9 ms 376 KB Output is correct
22 Correct 9 ms 376 KB Output is correct
23 Correct 9 ms 376 KB Output is correct
24 Correct 14 ms 376 KB Output is correct
25 Correct 144 ms 376 KB Output is correct
26 Execution timed out 1085 ms 256 KB Time limit exceeded
27 Halted 0 ms 0 KB -