답안 #670906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670906 2022-12-11T10:03:54 Z Dan4Life Bali Sculptures (APIO15_sculpture) C++17
0 / 100
35 ms 83736 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = (int)1e2+10;
const ll LINF = (ll)1e18;
int n, A, B;
ll a[maxn], pre[maxn]; int ans=32;
short int dp[maxn][maxn][maxn][32];

void recur(int pos, int lpos, int knum, int Or){
	if(dp[pos][lpos][knum][Or]!=-1) return;
	dp[pos][lpos][knum][Or]=1;
	if(pos==n+1) return;
	if(pos!=n) recur(pos+1, lpos, knum, Or);
	recur(pos+1, pos, knum+1, Or|(pre[pos]-pre[lpos]));
}

int32_t main() {
	cin >> n >> A >> B; memset(dp,-1,sizeof(dp));
	for(int i = 0; i < n; i++) cin >> a[i], pre[i+1]=pre[i]+a[i];
	recur(1,0,1,0);
	for(int i = A+1; i <= B+1; i++)
		for(int k = 0; k < 32; k++)
			if(dp[n+1][n][i][k]==1) ans = min(ans, k);
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 83532 KB Output is correct
2 Correct 32 ms 83532 KB Output is correct
3 Correct 31 ms 83636 KB Output is correct
4 Correct 32 ms 83540 KB Output is correct
5 Incorrect 33 ms 83608 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 83540 KB Output is correct
2 Correct 32 ms 83528 KB Output is correct
3 Correct 33 ms 83544 KB Output is correct
4 Correct 31 ms 83620 KB Output is correct
5 Incorrect 34 ms 83588 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 83648 KB Output is correct
2 Correct 29 ms 83640 KB Output is correct
3 Correct 30 ms 83624 KB Output is correct
4 Correct 31 ms 83632 KB Output is correct
5 Incorrect 31 ms 83640 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 83620 KB Output is correct
2 Correct 31 ms 83540 KB Output is correct
3 Correct 31 ms 83532 KB Output is correct
4 Correct 33 ms 83736 KB Output is correct
5 Incorrect 34 ms 83532 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 83612 KB Output is correct
2 Correct 32 ms 83616 KB Output is correct
3 Correct 31 ms 83636 KB Output is correct
4 Correct 31 ms 83624 KB Output is correct
5 Incorrect 31 ms 83636 KB Output isn't correct
6 Halted 0 ms 0 KB -