답안 #670907

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

void recur(int pos, int lpos, int knum, int Or){
	if(dp[pos][lpos][knum][Or]) 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;
	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 < 501; k++)
			if(dp[n+1][n][i][k]) ans = min(ans, k);
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 596 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 1 ms 1720 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 1 ms 1712 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 1 ms 948 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Correct 1 ms 1748 KB Output is correct
22 Correct 1 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 1 ms 1748 KB Output is correct
25 Correct 1 ms 1748 KB Output is correct
26 Correct 1 ms 1748 KB Output is correct
27 Runtime error 1 ms 468 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 1 ms 1748 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 436 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 1 ms 980 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Correct 1 ms 1748 KB Output is correct
22 Correct 1 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 1 ms 1748 KB Output is correct
25 Correct 1 ms 1764 KB Output is correct
26 Correct 1 ms 1692 KB Output is correct
27 Correct 1 ms 1876 KB Output is correct
28 Correct 2 ms 2772 KB Output is correct
29 Correct 5 ms 6868 KB Output is correct
30 Correct 7 ms 8532 KB Output is correct
31 Runtime error 28 ms 24140 KB Execution killed with signal 11
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 2 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 2 ms 1748 KB Output is correct
14 Correct 2 ms 1876 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
16 Correct 5 ms 6836 KB Output is correct
17 Correct 7 ms 8584 KB Output is correct
18 Runtime error 30 ms 24148 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 1208 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 1 ms 1748 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 432 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 1 ms 980 KB Output is correct
20 Correct 1 ms 1204 KB Output is correct
21 Correct 2 ms 1748 KB Output is correct
22 Correct 2 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 2 ms 1748 KB Output is correct
25 Correct 1 ms 1748 KB Output is correct
26 Correct 1 ms 1688 KB Output is correct
27 Runtime error 1 ms 468 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 1 ms 1748 KB Output is correct
12 Correct 1 ms 1748 KB Output is correct
13 Correct 2 ms 1748 KB Output is correct
14 Runtime error 1 ms 468 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -