Submission #566492

# Submission time Handle Problem Language Result Execution time Memory
566492 2022-05-22T11:09:26 Z ac2hu Bali Sculptures (APIO15_sculpture) C++14
0 / 100
310 ms 262144 KB
#include <bits/stdc++.h>
#ifdef DEBUG
#include "../templates/debug.h"
#else 
#define deb(x...)
#endif
using namespace std;
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;
    vector<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].push_back(e|tsum);
                }
            }
        }
    }
    int ans = 1e9;
    for(int i = a;i<=b;i++){
        deb(i, dp[n][i]);
        if(dp[n][i].size() != 0)
            ans = min(ans, *min_element(dp[n][i].begin(), dp[n][i].end()));
    }
    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 468 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 6 ms 4812 KB Output is correct
9 Correct 6 ms 4772 KB Output is correct
10 Correct 6 ms 4800 KB Output is correct
11 Correct 6 ms 4812 KB Output is correct
12 Correct 6 ms 4812 KB Output is correct
13 Correct 6 ms 4808 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 6 ms 4812 KB Output is correct
22 Correct 6 ms 4812 KB Output is correct
23 Correct 6 ms 4712 KB Output is correct
24 Correct 6 ms 4812 KB Output is correct
25 Correct 7 ms 4812 KB Output is correct
26 Correct 7 ms 4812 KB Output is correct
27 Incorrect 1 ms 212 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 468 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 6 ms 4792 KB Output is correct
9 Correct 6 ms 4812 KB Output is correct
10 Correct 6 ms 4684 KB Output is correct
11 Correct 6 ms 4780 KB Output is correct
12 Correct 5 ms 4812 KB Output is correct
13 Correct 7 ms 4812 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 6 ms 4788 KB Output is correct
22 Correct 6 ms 4812 KB Output is correct
23 Correct 6 ms 4812 KB Output is correct
24 Correct 6 ms 4812 KB Output is correct
25 Correct 6 ms 4812 KB Output is correct
26 Correct 8 ms 4808 KB Output is correct
27 Correct 13 ms 9236 KB Output is correct
28 Correct 170 ms 138864 KB Output is correct
29 Runtime error 302 ms 262144 KB Execution killed with signal 9
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 468 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 6 ms 4812 KB Output is correct
9 Correct 5 ms 4812 KB Output is correct
10 Correct 6 ms 4812 KB Output is correct
11 Correct 6 ms 4732 KB Output is correct
12 Correct 6 ms 4796 KB Output is correct
13 Correct 7 ms 4716 KB Output is correct
14 Correct 13 ms 9140 KB Output is correct
15 Correct 172 ms 138760 KB Output is correct
16 Runtime error 310 ms 262144 KB Execution killed with signal 9
17 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 1 ms 468 KB Output is correct
7 Correct 1 ms 832 KB Output is correct
8 Correct 6 ms 4784 KB Output is correct
9 Correct 7 ms 4792 KB Output is correct
10 Correct 7 ms 4812 KB Output is correct
11 Correct 6 ms 4812 KB Output is correct
12 Correct 6 ms 4784 KB Output is correct
13 Correct 7 ms 4756 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 1 ms 448 KB Output is correct
20 Correct 1 ms 828 KB Output is correct
21 Correct 7 ms 4684 KB Output is correct
22 Correct 6 ms 4792 KB Output is correct
23 Correct 5 ms 4796 KB Output is correct
24 Correct 7 ms 4812 KB Output is correct
25 Correct 6 ms 4792 KB Output is correct
26 Correct 7 ms 4812 KB Output is correct
27 Incorrect 0 ms 212 KB Output isn't correct
28 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 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 6 ms 4812 KB Output is correct
9 Correct 7 ms 4768 KB Output is correct
10 Correct 6 ms 4812 KB Output is correct
11 Correct 6 ms 4756 KB Output is correct
12 Correct 6 ms 4776 KB Output is correct
13 Correct 7 ms 4812 KB Output is correct
14 Incorrect 1 ms 212 KB Output isn't correct
15 Halted 0 ms 0 KB -