Submission #566497

# Submission time Handle Problem Language Result Execution time Memory
566497 2022-05-22T11:12:20 Z ac2hu Bali Sculptures (APIO15_sculpture) C++14
46 / 100
1000 ms 66408 KB
#include <bits/stdc++.h>
#ifdef DEBUG
#include "../templates/debug.h"
#else 
#define deb(x...)
#endif
using namespace std;
#define int long long 
signed main() {
    iostream::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
    int n, a, b;cin >> n >> a >> b;
    vector<int> Y(n);
    for(auto &e : Y)cin >> e;
    set<int> dp[n + 1][n + 1];
    dp[0][0] = {0};
    for(int i = 1;i<=n;i++){
        for(int gsize = 1;gsize<=n;gsize++){
            int tsum = 0;
            for(int j = i;j>=1;j--){
                tsum += Y[j - 1];
                if(dp[j - 1][gsize - 1].size() != 0){
                    for(auto e : dp[j - 1][gsize - 1])
                        dp[i][gsize].insert(e|tsum);
                }
            }
        }
    }
    int ans = 1e18;
    for(int i = a;i<=b;i++){
        deb(i, dp[n][i]);
        if(dp[n][i].size() != 0)
            ans = min(ans, *dp[n][i].begin());
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 324 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 3 ms 724 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 312 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 468 KB Output is correct
29 Correct 5 ms 724 KB Output is correct
30 Correct 6 ms 960 KB Output is correct
31 Correct 16 ms 1792 KB Output is correct
32 Correct 9 ms 1088 KB Output is correct
33 Correct 8 ms 1108 KB Output is correct
34 Correct 11 ms 1364 KB Output is correct
35 Correct 10 ms 1300 KB Output is correct
36 Correct 14 ms 1416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 5 ms 852 KB Output is correct
17 Correct 6 ms 980 KB Output is correct
18 Correct 16 ms 1876 KB Output is correct
19 Correct 8 ms 1088 KB Output is correct
20 Correct 8 ms 1084 KB Output is correct
21 Correct 11 ms 1320 KB Output is correct
22 Correct 10 ms 1344 KB Output is correct
23 Correct 13 ms 1472 KB Output is correct
24 Correct 18 ms 1980 KB Output is correct
25 Correct 50 ms 3808 KB Output is correct
26 Correct 105 ms 6356 KB Output is correct
27 Correct 166 ms 9064 KB Output is correct
28 Correct 253 ms 11736 KB Output is correct
29 Correct 145 ms 8040 KB Output is correct
30 Correct 149 ms 8044 KB Output is correct
31 Correct 294 ms 13484 KB Output is correct
32 Correct 306 ms 13468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 3 ms 724 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 0 ms 320 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 2 ms 468 KB Output is correct
39 Correct 6 ms 852 KB Output is correct
40 Correct 8 ms 980 KB Output is correct
41 Correct 18 ms 1844 KB Output is correct
42 Correct 8 ms 1124 KB Output is correct
43 Correct 8 ms 1108 KB Output is correct
44 Correct 10 ms 1340 KB Output is correct
45 Correct 10 ms 1364 KB Output is correct
46 Correct 13 ms 1492 KB Output is correct
47 Correct 21 ms 1988 KB Output is correct
48 Correct 57 ms 3848 KB Output is correct
49 Correct 102 ms 6428 KB Output is correct
50 Correct 172 ms 8896 KB Output is correct
51 Correct 251 ms 11664 KB Output is correct
52 Correct 151 ms 8012 KB Output is correct
53 Correct 149 ms 8040 KB Output is correct
54 Correct 292 ms 13348 KB Output is correct
55 Correct 303 ms 13468 KB Output is correct
56 Correct 494 ms 35832 KB Output is correct
57 Execution timed out 1094 ms 66408 KB Time limit exceeded
58 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 3 ms 708 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 444 KB Output is correct
26 Correct 5 ms 724 KB Output is correct
27 Correct 6 ms 980 KB Output is correct
28 Correct 16 ms 1872 KB Output is correct
29 Correct 8 ms 1108 KB Output is correct
30 Correct 8 ms 1108 KB Output is correct
31 Correct 11 ms 1340 KB Output is correct
32 Correct 10 ms 1364 KB Output is correct
33 Correct 13 ms 1492 KB Output is correct
34 Correct 18 ms 1908 KB Output is correct
35 Correct 56 ms 3784 KB Output is correct
36 Correct 105 ms 6408 KB Output is correct
37 Correct 168 ms 8852 KB Output is correct
38 Correct 252 ms 11584 KB Output is correct
39 Correct 159 ms 7984 KB Output is correct
40 Correct 145 ms 7972 KB Output is correct
41 Correct 295 ms 13428 KB Output is correct
42 Correct 306 ms 13480 KB Output is correct
43 Correct 515 ms 36052 KB Output is correct
44 Execution timed out 1040 ms 63584 KB Time limit exceeded
45 Halted 0 ms 0 KB -