답안 #670893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670893 2022-12-11T09:26:27 Z Dan4Life Bali Sculptures (APIO15_sculpture) C++17
0 / 100
15 ms 31960 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = (int)2e3+10;
const int LINF = (int)1e18;
int n, A, B;
int a[maxn];
int dp[maxn][maxn];

int recur(int pos, int k, int tot, int Or){
	if(k>B) return LINF;
	if(dp[pos][k]!=-1) return dp[pos][k];
	if(pos==n){
		if(k<A or k>B) return LINF;
		return Or|tot;
	}
	int x1 = recur(pos+1,k,tot+a[pos],Or);
	int x2 = recur(pos+1,k+1,a[pos],Or|tot);
	return dp[pos][k] = min(x1,x2);
}

int32_t main() {
	cin >> n >> A >> B; memset(dp,-1,sizeof(dp));
	for(int i = 0; i < n; i++) cin >> a[i];
	cout << recur(0,1,0,0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 31828 KB Output is correct
2 Correct 13 ms 31856 KB Output is correct
3 Correct 13 ms 31828 KB Output is correct
4 Correct 13 ms 31928 KB Output is correct
5 Correct 13 ms 31832 KB Output is correct
6 Incorrect 13 ms 31832 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 31832 KB Output is correct
2 Correct 12 ms 31828 KB Output is correct
3 Correct 14 ms 31956 KB Output is correct
4 Correct 12 ms 31828 KB Output is correct
5 Correct 12 ms 31920 KB Output is correct
6 Incorrect 12 ms 31920 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 31828 KB Output is correct
2 Correct 12 ms 31924 KB Output is correct
3 Correct 13 ms 31876 KB Output is correct
4 Correct 12 ms 31884 KB Output is correct
5 Correct 12 ms 31924 KB Output is correct
6 Incorrect 12 ms 31828 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 31960 KB Output is correct
2 Correct 13 ms 31912 KB Output is correct
3 Correct 12 ms 31828 KB Output is correct
4 Correct 13 ms 31828 KB Output is correct
5 Correct 13 ms 31828 KB Output is correct
6 Incorrect 11 ms 31920 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 31828 KB Output is correct
2 Correct 12 ms 31828 KB Output is correct
3 Correct 13 ms 31828 KB Output is correct
4 Correct 13 ms 31828 KB Output is correct
5 Correct 13 ms 31924 KB Output is correct
6 Incorrect 13 ms 31828 KB Output isn't correct
7 Halted 0 ms 0 KB -