Submission #43580

# Submission time Handle Problem Language Result Execution time Memory
43580 2018-03-18T00:20:11 Z RezwanArefin01 Bali Sculptures (APIO15_sculpture) C++14
37 / 100
193 ms 165548 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii; 

int dp[101][101][2050], a[110], p[110], n; 

int f(int i, int k, int o) {
	if(k > i) return 1e9; 
	if(k == 1) return p[i] | o;
	int &ret = dp[i][k][o];
	if(ret != -1) return ret;

	int sum = a[i];
	ret = 1e9;
	for(int j = i - 1; j >= 1; j--) {
		ret = min(ret, f(j, k - 1, sum | o) | sum | o); 
		sum += a[j];
	}
	return ret;
}
int main(int argc, char const *argv[]) {
#ifdef LOCAL_TESTING
	freopen("in", "r", stdin);
#endif
	int n, l, r;
	cin >> n >> l >> r; 
	for(int i = 1; i <= n; i++) {
		cin >> a[i]; p[i] = p[i - 1] + a[i];
	}

	memset(dp, -1, sizeof dp); 
	int ans = 1e9;

	for(int i = l; i <= r; i++) {
		ans = min(ans, f(n, i, 0));
	}
	cout << ans << endl;

}
# Verdict Execution time Memory Grader output
1 Correct 62 ms 82168 KB Output is correct
2 Correct 59 ms 82276 KB Output is correct
3 Correct 61 ms 82384 KB Output is correct
4 Correct 60 ms 82384 KB Output is correct
5 Correct 59 ms 82416 KB Output is correct
6 Correct 61 ms 82420 KB Output is correct
7 Correct 59 ms 82460 KB Output is correct
8 Correct 62 ms 82556 KB Output is correct
9 Correct 66 ms 82556 KB Output is correct
10 Correct 62 ms 82600 KB Output is correct
11 Correct 62 ms 82600 KB Output is correct
12 Correct 59 ms 82636 KB Output is correct
13 Correct 60 ms 82668 KB Output is correct
14 Correct 60 ms 82668 KB Output is correct
15 Correct 59 ms 82668 KB Output is correct
16 Correct 60 ms 82700 KB Output is correct
17 Correct 59 ms 82700 KB Output is correct
18 Correct 66 ms 82700 KB Output is correct
19 Correct 60 ms 82700 KB Output is correct
20 Correct 59 ms 82716 KB Output is correct
21 Correct 59 ms 82716 KB Output is correct
22 Correct 62 ms 82716 KB Output is correct
23 Correct 61 ms 82716 KB Output is correct
24 Correct 62 ms 82716 KB Output is correct
25 Correct 60 ms 82716 KB Output is correct
26 Correct 63 ms 82716 KB Output is correct
27 Runtime error 138 ms 164572 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 164624 KB Output is correct
2 Correct 59 ms 164624 KB Output is correct
3 Correct 61 ms 164760 KB Output is correct
4 Correct 62 ms 164760 KB Output is correct
5 Correct 60 ms 164768 KB Output is correct
6 Correct 64 ms 164772 KB Output is correct
7 Correct 70 ms 164772 KB Output is correct
8 Correct 59 ms 164772 KB Output is correct
9 Correct 61 ms 164772 KB Output is correct
10 Correct 64 ms 164772 KB Output is correct
11 Correct 60 ms 164772 KB Output is correct
12 Correct 67 ms 164772 KB Output is correct
13 Correct 60 ms 164772 KB Output is correct
14 Correct 60 ms 164772 KB Output is correct
15 Correct 59 ms 164772 KB Output is correct
16 Correct 59 ms 164772 KB Output is correct
17 Correct 65 ms 164772 KB Output is correct
18 Correct 59 ms 164772 KB Output is correct
19 Correct 59 ms 164772 KB Output is correct
20 Correct 59 ms 164772 KB Output is correct
21 Correct 62 ms 164772 KB Output is correct
22 Correct 61 ms 164772 KB Output is correct
23 Correct 61 ms 164772 KB Output is correct
24 Correct 63 ms 164772 KB Output is correct
25 Correct 65 ms 164772 KB Output is correct
26 Correct 59 ms 164772 KB Output is correct
27 Correct 59 ms 164772 KB Output is correct
28 Correct 59 ms 164772 KB Output is correct
29 Correct 61 ms 164772 KB Output is correct
30 Correct 64 ms 164868 KB Output is correct
31 Correct 76 ms 164868 KB Output is correct
32 Correct 69 ms 164868 KB Output is correct
33 Correct 60 ms 164868 KB Output is correct
34 Correct 77 ms 164868 KB Output is correct
35 Correct 63 ms 164892 KB Output is correct
36 Correct 67 ms 164892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 164892 KB Output is correct
2 Correct 59 ms 164892 KB Output is correct
3 Correct 59 ms 164892 KB Output is correct
4 Correct 60 ms 164892 KB Output is correct
5 Correct 60 ms 164892 KB Output is correct
6 Correct 59 ms 164892 KB Output is correct
7 Correct 61 ms 164892 KB Output is correct
8 Correct 60 ms 164892 KB Output is correct
9 Correct 59 ms 164892 KB Output is correct
10 Correct 60 ms 164936 KB Output is correct
11 Correct 61 ms 164936 KB Output is correct
12 Correct 60 ms 164936 KB Output is correct
13 Correct 59 ms 164936 KB Output is correct
14 Correct 61 ms 164936 KB Output is correct
15 Correct 61 ms 164936 KB Output is correct
16 Correct 59 ms 164936 KB Output is correct
17 Correct 67 ms 164936 KB Output is correct
18 Correct 67 ms 164972 KB Output is correct
19 Correct 63 ms 164972 KB Output is correct
20 Correct 59 ms 164972 KB Output is correct
21 Correct 66 ms 164972 KB Output is correct
22 Correct 67 ms 164972 KB Output is correct
23 Correct 65 ms 164972 KB Output is correct
24 Correct 69 ms 164972 KB Output is correct
25 Correct 64 ms 164972 KB Output is correct
26 Correct 82 ms 164972 KB Output is correct
27 Correct 140 ms 164972 KB Output is correct
28 Correct 167 ms 165012 KB Output is correct
29 Correct 151 ms 165012 KB Output is correct
30 Correct 57 ms 165012 KB Output is correct
31 Correct 166 ms 165012 KB Output is correct
32 Correct 193 ms 165028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 165032 KB Output is correct
2 Correct 59 ms 165032 KB Output is correct
3 Correct 62 ms 165032 KB Output is correct
4 Correct 59 ms 165032 KB Output is correct
5 Correct 59 ms 165032 KB Output is correct
6 Correct 64 ms 165032 KB Output is correct
7 Correct 59 ms 165032 KB Output is correct
8 Correct 59 ms 165032 KB Output is correct
9 Correct 59 ms 165032 KB Output is correct
10 Correct 61 ms 165032 KB Output is correct
11 Correct 59 ms 165032 KB Output is correct
12 Correct 59 ms 165032 KB Output is correct
13 Correct 59 ms 165032 KB Output is correct
14 Correct 62 ms 165032 KB Output is correct
15 Correct 59 ms 165032 KB Output is correct
16 Correct 59 ms 165032 KB Output is correct
17 Correct 59 ms 165032 KB Output is correct
18 Correct 59 ms 165032 KB Output is correct
19 Correct 64 ms 165032 KB Output is correct
20 Correct 63 ms 165032 KB Output is correct
21 Correct 61 ms 165032 KB Output is correct
22 Correct 59 ms 165032 KB Output is correct
23 Correct 60 ms 165032 KB Output is correct
24 Correct 62 ms 165032 KB Output is correct
25 Correct 60 ms 165060 KB Output is correct
26 Correct 59 ms 165060 KB Output is correct
27 Runtime error 159 ms 165300 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 165300 KB Output is correct
2 Correct 61 ms 165300 KB Output is correct
3 Correct 59 ms 165428 KB Output is correct
4 Correct 59 ms 165428 KB Output is correct
5 Correct 59 ms 165428 KB Output is correct
6 Correct 58 ms 165428 KB Output is correct
7 Correct 60 ms 165488 KB Output is correct
8 Correct 62 ms 165488 KB Output is correct
9 Correct 59 ms 165488 KB Output is correct
10 Correct 60 ms 165488 KB Output is correct
11 Correct 59 ms 165488 KB Output is correct
12 Correct 60 ms 165540 KB Output is correct
13 Correct 62 ms 165544 KB Output is correct
14 Runtime error 149 ms 165548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -