Submission #883343

# Submission time Handle Problem Language Result Execution time Memory
883343 2023-12-05T07:55:39 Z SalihSahin Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 600 KB
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
 
using namespace std;
const int inf = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main(){
    ios_base::sync_with_stdio(false), cin.tie();
    int n, a, b;
    cin>>n>>a>>b;
    vector<int> arr(n);
    for(int i = 0; i < n; i++){
        cin>>arr[i];
    }

    int ans = inf;
    for(int j = 1; j < (1 << n); j += 2){
        int g = 0, val = 0, sum = 0;
        for(int i = 0; i < n; i++){
            if(j & (1 << i)){
                val |= sum;
                sum = 0;
                g++;
            }
            sum += arr[i];
        }
        val |= sum;
        if(g >= a && g <= b){
            ans = min(ans, val);
        }
    }

    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 6 ms 460 KB Output is correct
8 Correct 36 ms 348 KB Output is correct
9 Correct 35 ms 344 KB Output is correct
10 Correct 38 ms 348 KB Output is correct
11 Correct 36 ms 348 KB Output is correct
12 Correct 35 ms 348 KB Output is correct
13 Correct 35 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 452 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 452 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 39 ms 348 KB Output is correct
22 Correct 34 ms 344 KB Output is correct
23 Correct 34 ms 348 KB Output is correct
24 Correct 35 ms 344 KB Output is correct
25 Correct 34 ms 348 KB Output is correct
26 Correct 39 ms 344 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 17 ms 460 KB Output is correct
31 Correct 33 ms 344 KB Output is correct
32 Correct 35 ms 448 KB Output is correct
33 Correct 38 ms 348 KB Output is correct
34 Correct 35 ms 348 KB Output is correct
35 Correct 35 ms 432 KB Output is correct
36 Correct 35 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 4 ms 452 KB Output is correct
8 Correct 35 ms 344 KB Output is correct
9 Correct 37 ms 600 KB Output is correct
10 Correct 35 ms 348 KB Output is correct
11 Correct 35 ms 432 KB Output is correct
12 Correct 35 ms 432 KB Output is correct
13 Correct 35 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 34 ms 348 KB Output is correct
22 Correct 35 ms 344 KB Output is correct
23 Correct 39 ms 348 KB Output is correct
24 Correct 35 ms 348 KB Output is correct
25 Correct 34 ms 460 KB Output is correct
26 Correct 34 ms 432 KB Output is correct
27 Correct 75 ms 348 KB Output is correct
28 Execution timed out 1068 ms 348 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 35 ms 348 KB Output is correct
9 Correct 35 ms 344 KB Output is correct
10 Correct 35 ms 348 KB Output is correct
11 Correct 35 ms 344 KB Output is correct
12 Correct 35 ms 348 KB Output is correct
13 Correct 35 ms 348 KB Output is correct
14 Correct 71 ms 436 KB Output is correct
15 Execution timed out 1068 ms 348 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 35 ms 348 KB Output is correct
9 Correct 36 ms 344 KB Output is correct
10 Correct 35 ms 344 KB Output is correct
11 Correct 35 ms 348 KB Output is correct
12 Correct 36 ms 348 KB Output is correct
13 Correct 40 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 34 ms 456 KB Output is correct
22 Correct 34 ms 348 KB Output is correct
23 Correct 34 ms 452 KB Output is correct
24 Correct 35 ms 348 KB Output is correct
25 Correct 34 ms 348 KB Output is correct
26 Correct 34 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 17 ms 348 KB Output is correct
31 Correct 34 ms 348 KB Output is correct
32 Correct 35 ms 344 KB Output is correct
33 Correct 36 ms 436 KB Output is correct
34 Correct 35 ms 344 KB Output is correct
35 Correct 35 ms 348 KB Output is correct
36 Correct 35 ms 348 KB Output is correct
37 Correct 71 ms 348 KB Output is correct
38 Execution timed out 1024 ms 344 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 35 ms 344 KB Output is correct
9 Correct 43 ms 348 KB Output is correct
10 Correct 35 ms 432 KB Output is correct
11 Correct 35 ms 432 KB Output is correct
12 Correct 36 ms 344 KB Output is correct
13 Correct 35 ms 432 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 18 ms 348 KB Output is correct
18 Correct 34 ms 348 KB Output is correct
19 Correct 36 ms 348 KB Output is correct
20 Correct 34 ms 348 KB Output is correct
21 Correct 35 ms 344 KB Output is correct
22 Correct 35 ms 348 KB Output is correct
23 Correct 35 ms 448 KB Output is correct
24 Correct 71 ms 344 KB Output is correct
25 Execution timed out 1071 ms 348 KB Time limit exceeded
26 Halted 0 ms 0 KB -