답안 #1037740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037740 2024-07-29T07:33:27 Z Muhammet Bali Sculptures (APIO15_sculpture) C++17
9 / 100
1000 ms 2648 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define sz(x) (int)x.size()
#define ff first
#define ss second

const ll N = 300005;
const ll M = 1e9 + 7;

ll T, n, c[N], ans = 1e18, d[N], a, b;

void f(int x){
	if(x == n+1){
		ll y = 0, z = 0, cnt = 0;
		for(int i = 1; i <= n; i++){
			z += c[i];
			if(d[i] == 1){
				cnt++;
				y = (y|z);
				z = 0;
			}
		}
		if(z != 0) cnt++;
		y = (y|z);
		z = 0;
		if(cnt <= b and cnt >= a) ans = min(ans,y);
		return;
	}
	d[x] = 0;
	f(x+1);
	d[x] = 1;
	f(x+1);
}

int main(){
	ios::sync_with_stdio(false); cin.tie(0);

	cin >> n >> a >> b;
	for(int i = 1; i <= n; i++){
		cin >> c[i];
	}

	f(1);
	cout << ans;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
7 Correct 6 ms 2648 KB Output is correct
8 Correct 41 ms 2396 KB Output is correct
9 Correct 39 ms 2392 KB Output is correct
10 Correct 41 ms 2396 KB Output is correct
11 Correct 41 ms 2396 KB Output is correct
12 Correct 39 ms 2392 KB Output is correct
13 Correct 41 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 2 ms 2396 KB Output is correct
20 Correct 6 ms 2392 KB Output is correct
21 Correct 42 ms 2396 KB Output is correct
22 Correct 41 ms 2392 KB Output is correct
23 Correct 42 ms 2396 KB Output is correct
24 Correct 39 ms 2396 KB Output is correct
25 Correct 41 ms 2396 KB Output is correct
26 Correct 46 ms 2392 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 20 ms 2512 KB Output is correct
31 Correct 42 ms 2396 KB Output is correct
32 Correct 41 ms 2396 KB Output is correct
33 Correct 41 ms 2392 KB Output is correct
34 Correct 41 ms 2396 KB Output is correct
35 Correct 41 ms 2392 KB Output is correct
36 Correct 43 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
7 Correct 5 ms 2512 KB Output is correct
8 Correct 41 ms 2396 KB Output is correct
9 Correct 41 ms 2396 KB Output is correct
10 Correct 44 ms 2392 KB Output is correct
11 Correct 41 ms 2396 KB Output is correct
12 Correct 41 ms 2396 KB Output is correct
13 Correct 41 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 2 ms 2392 KB Output is correct
20 Correct 5 ms 2392 KB Output is correct
21 Correct 44 ms 2392 KB Output is correct
22 Correct 41 ms 2396 KB Output is correct
23 Correct 42 ms 2396 KB Output is correct
24 Correct 41 ms 2396 KB Output is correct
25 Correct 42 ms 2396 KB Output is correct
26 Correct 43 ms 2392 KB Output is correct
27 Correct 83 ms 2392 KB Output is correct
28 Execution timed out 1059 ms 2396 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 2 ms 2396 KB Output is correct
7 Correct 5 ms 2648 KB Output is correct
8 Correct 42 ms 2508 KB Output is correct
9 Correct 41 ms 2396 KB Output is correct
10 Correct 41 ms 2392 KB Output is correct
11 Correct 41 ms 2392 KB Output is correct
12 Correct 43 ms 2396 KB Output is correct
13 Correct 42 ms 2648 KB Output is correct
14 Correct 84 ms 2392 KB Output is correct
15 Execution timed out 1074 ms 2396 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 3 ms 2396 KB Output is correct
7 Correct 8 ms 2392 KB Output is correct
8 Correct 44 ms 2392 KB Output is correct
9 Correct 43 ms 2396 KB Output is correct
10 Correct 46 ms 2392 KB Output is correct
11 Correct 42 ms 2392 KB Output is correct
12 Correct 57 ms 2396 KB Output is correct
13 Correct 41 ms 2392 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 3 ms 2392 KB Output is correct
20 Correct 7 ms 2396 KB Output is correct
21 Correct 45 ms 2396 KB Output is correct
22 Correct 48 ms 2396 KB Output is correct
23 Correct 42 ms 2396 KB Output is correct
24 Correct 42 ms 2396 KB Output is correct
25 Correct 48 ms 2396 KB Output is correct
26 Correct 44 ms 2392 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 21 ms 2396 KB Output is correct
31 Correct 43 ms 2508 KB Output is correct
32 Correct 42 ms 2396 KB Output is correct
33 Correct 42 ms 2396 KB Output is correct
34 Correct 44 ms 2396 KB Output is correct
35 Correct 41 ms 2408 KB Output is correct
36 Correct 41 ms 2488 KB Output is correct
37 Correct 83 ms 2488 KB Output is correct
38 Execution timed out 1060 ms 2396 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 6 ms 2396 KB Output is correct
8 Correct 41 ms 2396 KB Output is correct
9 Correct 41 ms 2392 KB Output is correct
10 Correct 41 ms 2396 KB Output is correct
11 Correct 41 ms 2396 KB Output is correct
12 Correct 41 ms 2392 KB Output is correct
13 Correct 41 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 20 ms 2396 KB Output is correct
18 Correct 42 ms 2396 KB Output is correct
19 Correct 41 ms 2396 KB Output is correct
20 Correct 41 ms 2392 KB Output is correct
21 Correct 41 ms 2396 KB Output is correct
22 Correct 49 ms 2396 KB Output is correct
23 Correct 41 ms 2392 KB Output is correct
24 Correct 88 ms 2396 KB Output is correct
25 Execution timed out 1025 ms 2392 KB Time limit exceeded
26 Halted 0 ms 0 KB -