Submission #40947

# Submission time Handle Problem Language Result Execution time Memory
40947 2018-02-09T23:40:01 Z IvanC Bali Sculptures (APIO15_sculpture) C++14
50 / 100
123 ms 976 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2010;
int dp[MAXN],N,A,B;
ll soma[MAXN],proibido,atual;
ll calc(ll a,ll b){return soma[b] - soma[a-1];}
int solve(int pos){
	if(dp[pos] != -1) return dp[pos];
	if(pos == N + 1) return dp[pos] = 0;
	int best = MAXN;
	for(int quebra = pos;quebra<=N;quebra++){
		if((calc(pos,quebra)) & proibido) continue;
		best = min(best, 1 + solve(quebra+1));
	}
	return dp[pos] = best;
}
int main(){
	cin >> N >> A >> B;
	for(int i = 1;i<=N;i++){
		cin >> soma[i];
		soma[i] += soma[i-1];
	}
	for(ll i = 41;i>=0;i--){
		proibido |= (1LL << i);
		memset(dp,-1,sizeof(dp));
		if(solve(1) > B){
			proibido ^= (1LL << i);
			atual |= (1LL << i);
		}
	}
	cout << atual << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 520 KB Output is correct
8 Correct 2 ms 644 KB Output is correct
9 Correct 2 ms 644 KB Output is correct
10 Correct 2 ms 644 KB Output is correct
11 Correct 2 ms 644 KB Output is correct
12 Correct 2 ms 644 KB Output is correct
13 Correct 3 ms 644 KB Output is correct
14 Correct 1 ms 644 KB Output is correct
15 Incorrect 2 ms 644 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 644 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 2 ms 644 KB Output is correct
4 Correct 2 ms 644 KB Output is correct
5 Correct 2 ms 644 KB Output is correct
6 Correct 2 ms 644 KB Output is correct
7 Correct 2 ms 644 KB Output is correct
8 Correct 2 ms 644 KB Output is correct
9 Correct 2 ms 644 KB Output is correct
10 Correct 2 ms 644 KB Output is correct
11 Correct 2 ms 644 KB Output is correct
12 Correct 2 ms 644 KB Output is correct
13 Correct 2 ms 644 KB Output is correct
14 Correct 2 ms 644 KB Output is correct
15 Incorrect 2 ms 644 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 644 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 2 ms 644 KB Output is correct
4 Correct 2 ms 644 KB Output is correct
5 Correct 2 ms 644 KB Output is correct
6 Correct 2 ms 744 KB Output is correct
7 Correct 2 ms 744 KB Output is correct
8 Correct 2 ms 744 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 2 ms 744 KB Output is correct
11 Correct 2 ms 744 KB Output is correct
12 Correct 2 ms 744 KB Output is correct
13 Correct 2 ms 744 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 1 ms 744 KB Output is correct
17 Correct 2 ms 744 KB Output is correct
18 Correct 3 ms 744 KB Output is correct
19 Correct 2 ms 744 KB Output is correct
20 Correct 2 ms 744 KB Output is correct
21 Correct 2 ms 744 KB Output is correct
22 Correct 2 ms 744 KB Output is correct
23 Correct 2 ms 744 KB Output is correct
24 Correct 2 ms 744 KB Output is correct
25 Correct 2 ms 744 KB Output is correct
26 Correct 3 ms 744 KB Output is correct
27 Correct 2 ms 744 KB Output is correct
28 Correct 2 ms 744 KB Output is correct
29 Correct 3 ms 744 KB Output is correct
30 Correct 3 ms 744 KB Output is correct
31 Correct 3 ms 744 KB Output is correct
32 Correct 3 ms 744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 744 KB Output is correct
2 Correct 2 ms 744 KB Output is correct
3 Correct 1 ms 744 KB Output is correct
4 Correct 2 ms 744 KB Output is correct
5 Correct 1 ms 744 KB Output is correct
6 Correct 1 ms 744 KB Output is correct
7 Correct 1 ms 744 KB Output is correct
8 Correct 1 ms 744 KB Output is correct
9 Correct 1 ms 744 KB Output is correct
10 Correct 2 ms 744 KB Output is correct
11 Correct 2 ms 744 KB Output is correct
12 Correct 2 ms 744 KB Output is correct
13 Correct 2 ms 744 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Incorrect 2 ms 744 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 744 KB Output is correct
2 Correct 2 ms 744 KB Output is correct
3 Correct 1 ms 744 KB Output is correct
4 Correct 1 ms 744 KB Output is correct
5 Correct 2 ms 744 KB Output is correct
6 Correct 2 ms 744 KB Output is correct
7 Correct 2 ms 744 KB Output is correct
8 Correct 2 ms 744 KB Output is correct
9 Correct 2 ms 744 KB Output is correct
10 Correct 2 ms 744 KB Output is correct
11 Correct 2 ms 744 KB Output is correct
12 Correct 1 ms 744 KB Output is correct
13 Correct 2 ms 744 KB Output is correct
14 Correct 1 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 2 ms 744 KB Output is correct
17 Correct 1 ms 744 KB Output is correct
18 Correct 1 ms 744 KB Output is correct
19 Correct 1 ms 744 KB Output is correct
20 Correct 1 ms 744 KB Output is correct
21 Correct 1 ms 744 KB Output is correct
22 Correct 2 ms 744 KB Output is correct
23 Correct 2 ms 744 KB Output is correct
24 Correct 2 ms 744 KB Output is correct
25 Correct 2 ms 744 KB Output is correct
26 Correct 2 ms 744 KB Output is correct
27 Correct 2 ms 744 KB Output is correct
28 Correct 2 ms 744 KB Output is correct
29 Correct 2 ms 744 KB Output is correct
30 Correct 2 ms 744 KB Output is correct
31 Correct 2 ms 744 KB Output is correct
32 Correct 2 ms 744 KB Output is correct
33 Correct 2 ms 744 KB Output is correct
34 Correct 2 ms 744 KB Output is correct
35 Correct 2 ms 744 KB Output is correct
36 Correct 2 ms 744 KB Output is correct
37 Correct 2 ms 744 KB Output is correct
38 Correct 2 ms 744 KB Output is correct
39 Correct 2 ms 744 KB Output is correct
40 Correct 2 ms 744 KB Output is correct
41 Correct 3 ms 744 KB Output is correct
42 Correct 2 ms 744 KB Output is correct
43 Correct 1 ms 744 KB Output is correct
44 Correct 2 ms 744 KB Output is correct
45 Correct 2 ms 744 KB Output is correct
46 Correct 2 ms 744 KB Output is correct
47 Correct 3 ms 744 KB Output is correct
48 Correct 2 ms 748 KB Output is correct
49 Correct 2 ms 748 KB Output is correct
50 Correct 2 ms 748 KB Output is correct
51 Correct 2 ms 748 KB Output is correct
52 Correct 10 ms 748 KB Output is correct
53 Correct 12 ms 748 KB Output is correct
54 Correct 37 ms 748 KB Output is correct
55 Correct 28 ms 748 KB Output is correct
56 Correct 60 ms 820 KB Output is correct
57 Correct 56 ms 844 KB Output is correct
58 Correct 61 ms 848 KB Output is correct
59 Correct 123 ms 976 KB Output is correct
60 Correct 72 ms 976 KB Output is correct
61 Correct 2 ms 976 KB Output is correct
62 Correct 10 ms 976 KB Output is correct
63 Correct 35 ms 976 KB Output is correct
64 Correct 16 ms 976 KB Output is correct
65 Correct 29 ms 976 KB Output is correct
66 Correct 40 ms 976 KB Output is correct
67 Correct 57 ms 976 KB Output is correct
68 Correct 119 ms 976 KB Output is correct
69 Correct 50 ms 976 KB Output is correct