Submission #634094

# Submission time Handle Problem Language Result Execution time Memory
634094 2022-08-23T19:47:16 Z tvladm2009 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
187 ms 262144 KB
#include <iostream>
#include <vector>
#define int long long

using namespace std;

const int MAX_N = 2 * 1e3;
const int INF = (1LL << 10);
const int MAX_L = 11;
int y[MAX_N + 1], range[MAX_N + 1][MAX_N + 1];
vector<int> dp[MAX_N + 1][MAX_N + 1];
int n, a, b;

signed main() {
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        cin >> y[i];
        range[i][i] = y[i];
    }
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            range[i][j] = range[i][j - 1] + y[j];
        }
    }
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            dp[i][j].push_back(INF);
        }
    }
    dp[0][0].push_back(0);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= i; k++) {
                for (int it : dp[k - 1][j - 1]) {
                    dp[i][j].push_back(it | range[k][i]);
                }
            }
        }
    }
    int answer = INF;
    for (int i = a; i <= b; i++) {
        for (int it : dp[n][i]) {
            answer = min(answer, it);
        }
    }
    cout << answer;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 51 ms 94320 KB Output is correct
2 Correct 44 ms 94316 KB Output is correct
3 Correct 45 ms 94304 KB Output is correct
4 Correct 50 ms 94284 KB Output is correct
5 Correct 43 ms 94540 KB Output is correct
6 Correct 50 ms 100072 KB Output is correct
7 Correct 61 ms 118588 KB Output is correct
8 Runtime error 175 ms 262144 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 94372 KB Output is correct
2 Correct 49 ms 94280 KB Output is correct
3 Correct 47 ms 94284 KB Output is correct
4 Correct 47 ms 94336 KB Output is correct
5 Correct 47 ms 94536 KB Output is correct
6 Correct 48 ms 100064 KB Output is correct
7 Correct 61 ms 118620 KB Output is correct
8 Runtime error 175 ms 262144 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 94412 KB Output is correct
2 Correct 51 ms 94320 KB Output is correct
3 Correct 44 ms 94316 KB Output is correct
4 Correct 44 ms 94320 KB Output is correct
5 Correct 44 ms 94496 KB Output is correct
6 Correct 48 ms 100040 KB Output is correct
7 Correct 60 ms 118596 KB Output is correct
8 Runtime error 165 ms 262144 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 94296 KB Output is correct
2 Correct 45 ms 94404 KB Output is correct
3 Correct 49 ms 94244 KB Output is correct
4 Correct 44 ms 94220 KB Output is correct
5 Correct 44 ms 94484 KB Output is correct
6 Correct 48 ms 99992 KB Output is correct
7 Correct 64 ms 118764 KB Output is correct
8 Runtime error 187 ms 262144 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 94344 KB Output is correct
2 Correct 44 ms 94292 KB Output is correct
3 Correct 45 ms 94284 KB Output is correct
4 Correct 46 ms 94268 KB Output is correct
5 Correct 51 ms 94492 KB Output is correct
6 Correct 50 ms 100052 KB Output is correct
7 Correct 65 ms 118580 KB Output is correct
8 Runtime error 170 ms 262144 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -