Submission #552588

# Submission time Handle Problem Language Result Execution time Memory
552588 2022-04-23T11:31:55 Z QwertyPi Bali Sculptures (APIO15_sculpture) C++14
46 / 100
873 ms 262144 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;
const int N = 2001;
int dp[N];
int s[N], A[N];
vector<int> vals[N][N];
int32_t main(){
	int n, a, b;
	cin >> n >> a >> b;
	vals[0][0].push_back(0);
	for(int i = 1; i <= n; i++) cin >> A[i], s[i] = s[i - 1] + A[i];
	for(int i = 1; i <= n; i++){
		for(int k = 1; k <= i; k++){
			for(int j = 0; j < i; j++){
				for(auto v : vals[j][k - 1]){
					vals[i][k].push_back(v | (s[i] - s[j]));
				}
			}
			sort(vals[i][k].begin(), vals[i][k].end());
			vals[i][k].resize(unique(vals[i][k].begin(), vals[i][k].end()) - vals[i][k].begin());
		}
		// for(auto j : vals[i]) cout << j << ' '; cout << endl;
	}
	int ans = (1LL << 60);
	for(int i = a; i <= b; i++){
		ans = min(ans, vals[n][i].front());
	}
	cout << ans << endl;
}

# Verdict Execution time Memory Grader output
1 Correct 43 ms 94284 KB Output is correct
2 Correct 44 ms 94268 KB Output is correct
3 Correct 44 ms 94284 KB Output is correct
4 Correct 44 ms 94316 KB Output is correct
5 Correct 43 ms 94248 KB Output is correct
6 Correct 47 ms 94232 KB Output is correct
7 Correct 43 ms 94308 KB Output is correct
8 Correct 45 ms 94380 KB Output is correct
9 Correct 44 ms 94280 KB Output is correct
10 Correct 46 ms 94260 KB Output is correct
11 Correct 45 ms 94308 KB Output is correct
12 Correct 44 ms 94308 KB Output is correct
13 Correct 46 ms 94328 KB Output is correct
14 Correct 44 ms 94284 KB Output is correct
15 Correct 44 ms 94292 KB Output is correct
16 Correct 44 ms 94316 KB Output is correct
17 Correct 45 ms 94204 KB Output is correct
18 Correct 45 ms 94308 KB Output is correct
19 Correct 52 ms 94312 KB Output is correct
20 Correct 44 ms 94360 KB Output is correct
21 Correct 43 ms 94320 KB Output is correct
22 Correct 43 ms 94344 KB Output is correct
23 Correct 46 ms 94280 KB Output is correct
24 Correct 44 ms 94336 KB Output is correct
25 Correct 43 ms 94300 KB Output is correct
26 Correct 44 ms 94392 KB Output is correct
27 Correct 44 ms 94216 KB Output is correct
28 Correct 45 ms 94312 KB Output is correct
29 Correct 44 ms 94260 KB Output is correct
30 Correct 44 ms 94576 KB Output is correct
31 Correct 44 ms 94392 KB Output is correct
32 Correct 46 ms 94400 KB Output is correct
33 Correct 43 ms 94352 KB Output is correct
34 Correct 43 ms 94264 KB Output is correct
35 Correct 47 ms 94340 KB Output is correct
36 Correct 42 ms 94292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 94236 KB Output is correct
2 Correct 43 ms 94280 KB Output is correct
3 Correct 47 ms 94272 KB Output is correct
4 Correct 43 ms 94292 KB Output is correct
5 Correct 43 ms 94308 KB Output is correct
6 Correct 43 ms 94324 KB Output is correct
7 Correct 65 ms 94412 KB Output is correct
8 Correct 44 ms 94284 KB Output is correct
9 Correct 45 ms 94348 KB Output is correct
10 Correct 52 ms 94360 KB Output is correct
11 Correct 44 ms 94276 KB Output is correct
12 Correct 44 ms 94380 KB Output is correct
13 Correct 44 ms 94292 KB Output is correct
14 Correct 44 ms 94292 KB Output is correct
15 Correct 47 ms 94316 KB Output is correct
16 Correct 45 ms 94280 KB Output is correct
17 Correct 45 ms 94284 KB Output is correct
18 Correct 45 ms 94316 KB Output is correct
19 Correct 49 ms 94336 KB Output is correct
20 Correct 44 ms 94328 KB Output is correct
21 Correct 44 ms 94304 KB Output is correct
22 Correct 44 ms 94284 KB Output is correct
23 Correct 44 ms 94328 KB Output is correct
24 Correct 45 ms 94300 KB Output is correct
25 Correct 44 ms 94336 KB Output is correct
26 Correct 51 ms 94412 KB Output is correct
27 Correct 45 ms 94328 KB Output is correct
28 Correct 47 ms 94484 KB Output is correct
29 Correct 49 ms 95300 KB Output is correct
30 Correct 48 ms 95700 KB Output is correct
31 Correct 58 ms 98148 KB Output is correct
32 Correct 50 ms 96276 KB Output is correct
33 Correct 50 ms 96332 KB Output is correct
34 Correct 52 ms 96972 KB Output is correct
35 Correct 51 ms 96808 KB Output is correct
36 Correct 53 ms 97528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 94312 KB Output is correct
2 Correct 43 ms 94324 KB Output is correct
3 Correct 45 ms 94316 KB Output is correct
4 Correct 44 ms 94256 KB Output is correct
5 Correct 47 ms 94260 KB Output is correct
6 Correct 45 ms 94284 KB Output is correct
7 Correct 43 ms 94284 KB Output is correct
8 Correct 43 ms 94284 KB Output is correct
9 Correct 49 ms 94280 KB Output is correct
10 Correct 45 ms 94240 KB Output is correct
11 Correct 43 ms 94280 KB Output is correct
12 Correct 45 ms 94296 KB Output is correct
13 Correct 44 ms 94376 KB Output is correct
14 Correct 49 ms 94384 KB Output is correct
15 Correct 44 ms 94420 KB Output is correct
16 Correct 46 ms 95296 KB Output is correct
17 Correct 49 ms 95752 KB Output is correct
18 Correct 56 ms 98148 KB Output is correct
19 Correct 52 ms 96336 KB Output is correct
20 Correct 56 ms 96332 KB Output is correct
21 Correct 53 ms 96912 KB Output is correct
22 Correct 52 ms 96720 KB Output is correct
23 Correct 54 ms 97548 KB Output is correct
24 Correct 57 ms 98380 KB Output is correct
25 Correct 82 ms 105420 KB Output is correct
26 Correct 119 ms 116140 KB Output is correct
27 Correct 175 ms 129248 KB Output is correct
28 Correct 228 ms 145024 KB Output is correct
29 Correct 160 ms 129228 KB Output is correct
30 Correct 164 ms 129244 KB Output is correct
31 Correct 244 ms 149656 KB Output is correct
32 Correct 264 ms 152624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 94340 KB Output is correct
2 Correct 44 ms 94412 KB Output is correct
3 Correct 45 ms 94284 KB Output is correct
4 Correct 44 ms 94284 KB Output is correct
5 Correct 47 ms 94224 KB Output is correct
6 Correct 47 ms 94352 KB Output is correct
7 Correct 44 ms 94308 KB Output is correct
8 Correct 43 ms 94316 KB Output is correct
9 Correct 44 ms 94300 KB Output is correct
10 Correct 43 ms 94284 KB Output is correct
11 Correct 45 ms 94312 KB Output is correct
12 Correct 45 ms 94284 KB Output is correct
13 Correct 44 ms 94284 KB Output is correct
14 Correct 43 ms 94332 KB Output is correct
15 Correct 43 ms 94284 KB Output is correct
16 Correct 43 ms 94260 KB Output is correct
17 Correct 45 ms 94220 KB Output is correct
18 Correct 45 ms 94284 KB Output is correct
19 Correct 44 ms 94428 KB Output is correct
20 Correct 45 ms 94308 KB Output is correct
21 Correct 44 ms 94312 KB Output is correct
22 Correct 45 ms 94284 KB Output is correct
23 Correct 44 ms 94256 KB Output is correct
24 Correct 50 ms 94304 KB Output is correct
25 Correct 47 ms 94324 KB Output is correct
26 Correct 44 ms 94316 KB Output is correct
27 Correct 44 ms 94264 KB Output is correct
28 Correct 44 ms 94292 KB Output is correct
29 Correct 43 ms 94312 KB Output is correct
30 Correct 47 ms 94524 KB Output is correct
31 Correct 44 ms 94304 KB Output is correct
32 Correct 44 ms 94344 KB Output is correct
33 Correct 49 ms 94352 KB Output is correct
34 Correct 43 ms 94312 KB Output is correct
35 Correct 45 ms 94332 KB Output is correct
36 Correct 45 ms 94316 KB Output is correct
37 Correct 44 ms 94316 KB Output is correct
38 Correct 45 ms 94440 KB Output is correct
39 Correct 47 ms 95324 KB Output is correct
40 Correct 49 ms 95772 KB Output is correct
41 Correct 57 ms 98084 KB Output is correct
42 Correct 49 ms 96332 KB Output is correct
43 Correct 56 ms 96332 KB Output is correct
44 Correct 52 ms 96880 KB Output is correct
45 Correct 53 ms 96748 KB Output is correct
46 Correct 55 ms 97612 KB Output is correct
47 Correct 57 ms 98380 KB Output is correct
48 Correct 84 ms 105484 KB Output is correct
49 Correct 120 ms 116152 KB Output is correct
50 Correct 169 ms 129164 KB Output is correct
51 Correct 228 ms 145100 KB Output is correct
52 Correct 174 ms 129324 KB Output is correct
53 Correct 160 ms 129272 KB Output is correct
54 Correct 253 ms 149580 KB Output is correct
55 Correct 270 ms 152680 KB Output is correct
56 Correct 335 ms 150488 KB Output is correct
57 Runtime error 873 ms 262144 KB Execution killed with signal 9
58 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 94244 KB Output is correct
2 Correct 47 ms 94316 KB Output is correct
3 Correct 49 ms 94316 KB Output is correct
4 Correct 48 ms 94248 KB Output is correct
5 Correct 49 ms 94260 KB Output is correct
6 Correct 48 ms 94300 KB Output is correct
7 Correct 48 ms 94228 KB Output is correct
8 Correct 48 ms 94324 KB Output is correct
9 Correct 49 ms 94364 KB Output is correct
10 Correct 52 ms 94284 KB Output is correct
11 Correct 50 ms 94376 KB Output is correct
12 Correct 48 ms 94320 KB Output is correct
13 Correct 48 ms 94268 KB Output is correct
14 Correct 47 ms 94212 KB Output is correct
15 Correct 47 ms 94284 KB Output is correct
16 Correct 48 ms 94288 KB Output is correct
17 Correct 50 ms 94632 KB Output is correct
18 Correct 47 ms 94348 KB Output is correct
19 Correct 48 ms 94308 KB Output is correct
20 Correct 48 ms 94276 KB Output is correct
21 Correct 48 ms 94236 KB Output is correct
22 Correct 47 ms 94284 KB Output is correct
23 Correct 48 ms 94288 KB Output is correct
24 Correct 47 ms 94280 KB Output is correct
25 Correct 48 ms 94412 KB Output is correct
26 Correct 51 ms 95228 KB Output is correct
27 Correct 56 ms 95724 KB Output is correct
28 Correct 62 ms 98152 KB Output is correct
29 Correct 61 ms 96244 KB Output is correct
30 Correct 65 ms 96224 KB Output is correct
31 Correct 59 ms 96928 KB Output is correct
32 Correct 59 ms 96768 KB Output is correct
33 Correct 61 ms 97512 KB Output is correct
34 Correct 61 ms 98380 KB Output is correct
35 Correct 87 ms 105384 KB Output is correct
36 Correct 123 ms 116212 KB Output is correct
37 Correct 172 ms 129252 KB Output is correct
38 Correct 243 ms 145092 KB Output is correct
39 Correct 165 ms 129272 KB Output is correct
40 Correct 169 ms 129288 KB Output is correct
41 Correct 250 ms 149708 KB Output is correct
42 Correct 260 ms 152760 KB Output is correct
43 Correct 325 ms 150492 KB Output is correct
44 Runtime error 861 ms 262144 KB Execution killed with signal 9
45 Halted 0 ms 0 KB -