Submission #400635

# Submission time Handle Problem Language Result Execution time Memory
400635 2021-05-08T12:40:57 Z BERNARB01 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 17796 KB
#include <bits/stdc++.h>

using namespace std;

const int N = (int) 103;
const long long inf = (long long) 4e18;

int n, a, b, y[N];
long long dp[N][N][N];

long long sol(int i, long long run, int stage, long long sum = 0) {
	if (i == n) {
		if (a <= stage && stage <= b) {
			return run | sum;
		}
		return inf;
	}
	long long& ret = dp[i][stage][run];
	if (ret != -1) {
		//return ret;
	}
	sum += y[i];
	ret = sol(i + 1, run, stage, sum);
	if (stage + 1 <= b && i + 1 < n) {
		ret = min(ret, sol(i + 1, run | sum, stage + 1));
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		cin >> y[i];
	}
	memset(dp, -1, sizeof dp);
	cout << sol(0, 0, 1) << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8780 KB Output is correct
2 Correct 5 ms 8780 KB Output is correct
3 Correct 5 ms 8780 KB Output is correct
4 Correct 5 ms 8780 KB Output is correct
5 Correct 5 ms 8780 KB Output is correct
6 Correct 6 ms 8780 KB Output is correct
7 Correct 5 ms 8780 KB Output is correct
8 Correct 5 ms 8780 KB Output is correct
9 Correct 5 ms 8780 KB Output is correct
10 Correct 5 ms 8780 KB Output is correct
11 Correct 5 ms 8780 KB Output is correct
12 Correct 6 ms 8780 KB Output is correct
13 Correct 17 ms 8908 KB Output is correct
14 Correct 5 ms 8780 KB Output is correct
15 Correct 5 ms 8772 KB Output is correct
16 Correct 5 ms 8780 KB Output is correct
17 Correct 5 ms 8780 KB Output is correct
18 Correct 5 ms 8780 KB Output is correct
19 Correct 5 ms 8780 KB Output is correct
20 Correct 5 ms 8780 KB Output is correct
21 Correct 6 ms 8780 KB Output is correct
22 Correct 7 ms 8780 KB Output is correct
23 Correct 7 ms 8780 KB Output is correct
24 Correct 5 ms 8780 KB Output is correct
25 Correct 7 ms 8784 KB Output is correct
26 Correct 16 ms 8872 KB Output is correct
27 Runtime error 15 ms 17796 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8784 KB Output is correct
2 Correct 5 ms 8780 KB Output is correct
3 Correct 5 ms 8780 KB Output is correct
4 Correct 5 ms 8844 KB Output is correct
5 Correct 5 ms 8780 KB Output is correct
6 Correct 5 ms 8780 KB Output is correct
7 Correct 5 ms 8780 KB Output is correct
8 Correct 5 ms 8780 KB Output is correct
9 Correct 5 ms 8780 KB Output is correct
10 Correct 5 ms 8780 KB Output is correct
11 Correct 5 ms 8780 KB Output is correct
12 Correct 5 ms 8780 KB Output is correct
13 Correct 17 ms 8780 KB Output is correct
14 Correct 5 ms 8780 KB Output is correct
15 Correct 5 ms 8772 KB Output is correct
16 Correct 5 ms 8780 KB Output is correct
17 Correct 5 ms 8780 KB Output is correct
18 Correct 5 ms 8780 KB Output is correct
19 Correct 6 ms 8780 KB Output is correct
20 Correct 5 ms 8780 KB Output is correct
21 Correct 7 ms 8780 KB Output is correct
22 Correct 7 ms 8876 KB Output is correct
23 Correct 7 ms 8876 KB Output is correct
24 Correct 5 ms 8780 KB Output is correct
25 Correct 7 ms 8780 KB Output is correct
26 Correct 16 ms 8880 KB Output is correct
27 Correct 28 ms 8872 KB Output is correct
28 Correct 81 ms 8780 KB Output is correct
29 Correct 11 ms 8780 KB Output is correct
30 Execution timed out 1088 ms 8780 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8780 KB Output is correct
2 Correct 5 ms 8780 KB Output is correct
3 Correct 5 ms 8780 KB Output is correct
4 Correct 5 ms 8780 KB Output is correct
5 Correct 5 ms 8780 KB Output is correct
6 Correct 5 ms 8780 KB Output is correct
7 Correct 5 ms 8780 KB Output is correct
8 Correct 5 ms 8780 KB Output is correct
9 Correct 5 ms 8796 KB Output is correct
10 Correct 5 ms 8780 KB Output is correct
11 Correct 6 ms 8788 KB Output is correct
12 Correct 6 ms 8780 KB Output is correct
13 Correct 17 ms 8876 KB Output is correct
14 Correct 27 ms 8780 KB Output is correct
15 Correct 79 ms 8784 KB Output is correct
16 Correct 11 ms 8780 KB Output is correct
17 Execution timed out 1091 ms 8780 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8780 KB Output is correct
2 Correct 5 ms 8780 KB Output is correct
3 Correct 5 ms 8780 KB Output is correct
4 Correct 5 ms 8792 KB Output is correct
5 Correct 5 ms 8780 KB Output is correct
6 Correct 5 ms 8780 KB Output is correct
7 Correct 5 ms 8828 KB Output is correct
8 Correct 6 ms 8780 KB Output is correct
9 Correct 5 ms 8780 KB Output is correct
10 Correct 5 ms 8780 KB Output is correct
11 Correct 5 ms 8780 KB Output is correct
12 Correct 5 ms 8784 KB Output is correct
13 Correct 16 ms 8876 KB Output is correct
14 Correct 5 ms 8780 KB Output is correct
15 Correct 5 ms 8780 KB Output is correct
16 Correct 5 ms 8780 KB Output is correct
17 Correct 5 ms 8780 KB Output is correct
18 Correct 5 ms 8780 KB Output is correct
19 Correct 5 ms 8772 KB Output is correct
20 Correct 5 ms 8780 KB Output is correct
21 Correct 7 ms 8780 KB Output is correct
22 Correct 7 ms 8876 KB Output is correct
23 Correct 7 ms 8780 KB Output is correct
24 Correct 5 ms 8780 KB Output is correct
25 Correct 7 ms 8780 KB Output is correct
26 Correct 16 ms 8872 KB Output is correct
27 Runtime error 14 ms 17712 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8780 KB Output is correct
2 Correct 5 ms 8780 KB Output is correct
3 Correct 5 ms 8856 KB Output is correct
4 Correct 5 ms 8780 KB Output is correct
5 Correct 5 ms 8784 KB Output is correct
6 Correct 5 ms 8780 KB Output is correct
7 Correct 5 ms 8780 KB Output is correct
8 Correct 5 ms 8780 KB Output is correct
9 Correct 5 ms 8780 KB Output is correct
10 Correct 5 ms 8780 KB Output is correct
11 Correct 5 ms 8780 KB Output is correct
12 Correct 5 ms 8784 KB Output is correct
13 Correct 16 ms 8780 KB Output is correct
14 Runtime error 15 ms 17788 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -