답안 #400634

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
400634 2021-05-08T12:40:22 Z BERNARB01 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
6 ms 8872 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8780 KB Output is correct
2 Correct 5 ms 8784 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 Incorrect 5 ms 8872 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 8776 KB Output is correct
6 Correct 5 ms 8776 KB Output is correct
7 Incorrect 5 ms 8780 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8772 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 Incorrect 6 ms 8780 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8780 KB Output is correct
2 Correct 5 ms 8772 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 Incorrect 5 ms 8780 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 6 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 Incorrect 5 ms 8780 KB Output isn't correct
8 Halted 0 ms 0 KB -