Submission #43582

# Submission time Handle Problem Language Result Execution time Memory
43582 2018-03-18T00:34:00 Z RezwanArefin01 Bali Sculptures (APIO15_sculpture) C++14
16 / 100
1000 ms 16132 KB
#include <bits/stdc++.h>
using namespace std;

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

map<int, int> dp[110][110]; 

int a[110], p[110], n; 

int f(int i, int k, int o) {
	if(k > i) return 1 << 30; 
	if(k == 1) return p[i] | o;

	if(dp[i][k].count(o)) return dp[i][k][o];

	int &ret = dp[i][k][o] = 1 << 30;

	int sum = a[i];
	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];
	}

	int ans = 2e9;

	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 2 ms 888 KB Output is correct
2 Correct 2 ms 888 KB Output is correct
3 Correct 2 ms 916 KB Output is correct
4 Correct 2 ms 916 KB Output is correct
5 Correct 2 ms 976 KB Output is correct
6 Correct 2 ms 1044 KB Output is correct
7 Correct 2 ms 1060 KB Output is correct
8 Correct 2 ms 1136 KB Output is correct
9 Correct 2 ms 1136 KB Output is correct
10 Correct 2 ms 1136 KB Output is correct
11 Correct 2 ms 1136 KB Output is correct
12 Correct 2 ms 1136 KB Output is correct
13 Correct 2 ms 1136 KB Output is correct
14 Correct 2 ms 1136 KB Output is correct
15 Correct 2 ms 1136 KB Output is correct
16 Correct 2 ms 1136 KB Output is correct
17 Correct 2 ms 1136 KB Output is correct
18 Correct 2 ms 1136 KB Output is correct
19 Correct 2 ms 1136 KB Output is correct
20 Correct 2 ms 1136 KB Output is correct
21 Correct 2 ms 1188 KB Output is correct
22 Correct 2 ms 1188 KB Output is correct
23 Correct 2 ms 1188 KB Output is correct
24 Correct 2 ms 1188 KB Output is correct
25 Correct 2 ms 1188 KB Output is correct
26 Correct 2 ms 1188 KB Output is correct
27 Incorrect 2 ms 1188 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1188 KB Output is correct
2 Correct 2 ms 1188 KB Output is correct
3 Correct 2 ms 1188 KB Output is correct
4 Correct 2 ms 1188 KB Output is correct
5 Correct 2 ms 1188 KB Output is correct
6 Correct 2 ms 1188 KB Output is correct
7 Correct 2 ms 1188 KB Output is correct
8 Correct 2 ms 1188 KB Output is correct
9 Correct 2 ms 1188 KB Output is correct
10 Correct 2 ms 1188 KB Output is correct
11 Correct 2 ms 1188 KB Output is correct
12 Correct 2 ms 1188 KB Output is correct
13 Correct 2 ms 1188 KB Output is correct
14 Correct 2 ms 1188 KB Output is correct
15 Correct 2 ms 1188 KB Output is correct
16 Correct 2 ms 1188 KB Output is correct
17 Correct 2 ms 1188 KB Output is correct
18 Correct 2 ms 1188 KB Output is correct
19 Correct 2 ms 1188 KB Output is correct
20 Correct 2 ms 1188 KB Output is correct
21 Correct 2 ms 1188 KB Output is correct
22 Correct 2 ms 1188 KB Output is correct
23 Correct 3 ms 1188 KB Output is correct
24 Correct 2 ms 1188 KB Output is correct
25 Correct 2 ms 1188 KB Output is correct
26 Correct 2 ms 1188 KB Output is correct
27 Correct 2 ms 1188 KB Output is correct
28 Correct 3 ms 1188 KB Output is correct
29 Correct 3 ms 1188 KB Output is correct
30 Correct 10 ms 1644 KB Output is correct
31 Correct 43 ms 2412 KB Output is correct
32 Correct 25 ms 2412 KB Output is correct
33 Correct 2 ms 2412 KB Output is correct
34 Correct 22 ms 2412 KB Output is correct
35 Correct 31 ms 2412 KB Output is correct
36 Correct 11 ms 2412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2412 KB Output is correct
2 Correct 2 ms 2412 KB Output is correct
3 Correct 2 ms 2412 KB Output is correct
4 Correct 2 ms 2412 KB Output is correct
5 Correct 2 ms 2412 KB Output is correct
6 Correct 2 ms 2412 KB Output is correct
7 Correct 2 ms 2412 KB Output is correct
8 Correct 2 ms 2412 KB Output is correct
9 Correct 2 ms 2412 KB Output is correct
10 Correct 2 ms 2412 KB Output is correct
11 Correct 2 ms 2412 KB Output is correct
12 Correct 2 ms 2412 KB Output is correct
13 Correct 2 ms 2412 KB Output is correct
14 Correct 2 ms 2412 KB Output is correct
15 Correct 2 ms 2412 KB Output is correct
16 Correct 3 ms 2412 KB Output is correct
17 Correct 11 ms 2412 KB Output is correct
18 Correct 41 ms 2412 KB Output is correct
19 Correct 26 ms 2412 KB Output is correct
20 Correct 2 ms 2412 KB Output is correct
21 Correct 26 ms 2412 KB Output is correct
22 Correct 33 ms 2412 KB Output is correct
23 Correct 11 ms 2412 KB Output is correct
24 Correct 34 ms 2412 KB Output is correct
25 Correct 44 ms 2412 KB Output is correct
26 Correct 335 ms 6616 KB Output is correct
27 Execution timed out 1060 ms 16132 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 16132 KB Output is correct
2 Correct 2 ms 16132 KB Output is correct
3 Correct 2 ms 16132 KB Output is correct
4 Correct 2 ms 16132 KB Output is correct
5 Correct 2 ms 16132 KB Output is correct
6 Correct 2 ms 16132 KB Output is correct
7 Correct 2 ms 16132 KB Output is correct
8 Correct 2 ms 16132 KB Output is correct
9 Correct 2 ms 16132 KB Output is correct
10 Correct 2 ms 16132 KB Output is correct
11 Correct 2 ms 16132 KB Output is correct
12 Correct 2 ms 16132 KB Output is correct
13 Correct 2 ms 16132 KB Output is correct
14 Correct 2 ms 16132 KB Output is correct
15 Correct 2 ms 16132 KB Output is correct
16 Correct 2 ms 16132 KB Output is correct
17 Correct 2 ms 16132 KB Output is correct
18 Correct 2 ms 16132 KB Output is correct
19 Correct 2 ms 16132 KB Output is correct
20 Correct 2 ms 16132 KB Output is correct
21 Correct 2 ms 16132 KB Output is correct
22 Correct 2 ms 16132 KB Output is correct
23 Correct 2 ms 16132 KB Output is correct
24 Correct 2 ms 16132 KB Output is correct
25 Correct 2 ms 16132 KB Output is correct
26 Correct 2 ms 16132 KB Output is correct
27 Incorrect 2 ms 16132 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 16132 KB Output is correct
2 Correct 2 ms 16132 KB Output is correct
3 Correct 2 ms 16132 KB Output is correct
4 Correct 2 ms 16132 KB Output is correct
5 Correct 2 ms 16132 KB Output is correct
6 Correct 2 ms 16132 KB Output is correct
7 Correct 2 ms 16132 KB Output is correct
8 Correct 2 ms 16132 KB Output is correct
9 Correct 2 ms 16132 KB Output is correct
10 Correct 2 ms 16132 KB Output is correct
11 Correct 2 ms 16132 KB Output is correct
12 Correct 2 ms 16132 KB Output is correct
13 Correct 2 ms 16132 KB Output is correct
14 Incorrect 2 ms 16132 KB Output isn't correct
15 Halted 0 ms 0 KB -