Submission #670902

# Submission time Handle Problem Language Result Execution time Memory
670902 2022-12-11T09:57:38 Z Dan4Life Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = (int)1e2+10;
const int LINF = (int)1e18;
int n, A, B, ans=LINF;
int a[maxn], pre[maxn];
bool dp[maxn][maxn][maxn][32];

void recur(int pos, int lpos, int knum, int Or){
	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;
	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 = 0; i <= n; i++)
		for(int j = A+1; j <= B+1; j++)
			for(int k = 0; k < 32; k++)
				if(dp[n+1][i][j][k]) ans = min(ans, k);
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Incorrect 0 ms 468 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Incorrect 0 ms 468 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Incorrect 0 ms 468 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Incorrect 0 ms 468 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Incorrect 0 ms 468 KB Output isn't correct
6 Halted 0 ms 0 KB -