답안 #199400

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199400 2020-02-01T08:17:13 Z detaomega Bali Sculptures (APIO15_sculpture) C++14
71 / 100
33 ms 504 KB
//#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define de(x,y) cout<<#x<<" :"<<x<<y;
#define int long long
typedef pair<int,int> pii;

const int maxn = 1e2+5;

int arr[maxn], ans = 0, n, A, B;
int pre[maxn];
int two[60];
void solve() {
	int dp[maxn][maxn];
	int digit = __lg(pre[n]);
	for(int x=digit; x>=0; x--) {
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
		for(int i=1; i<=n; i++) {
			for(int j=1; j<=n; j++) {
				for(int k=0; k<i; k++) {
					if(dp[k][j-1]) {
						int tmp = pre[i] - pre[k];
						if((tmp & (two[x])) == 0 &&((tmp>>(int)(x+1))|ans)==ans ) {
							dp[i][j] = 1;
						}
					}
				} 
			} 
		}	
		ans<<=1;
		ans++; 
		for(int i=A; i<=B; i++) {
			if(dp[n][i]) {
				ans--;
				break;
			}
		}
	}
}
main() {
//	int n, A, B;
	cin >> n >> A >> B;
	two[0] = 1;
	for(int i=1; i<=50; i++) {
		two[i] = two[i-1] * 2;
	}
	pre[0] = 0;
	for(int i=1; i<=n; i++) {
		cin >> arr[i];
		pre[i] = pre[i-1] + arr[i];
	}
	solve();
	cout << ans << "\n"; 



}

Compilation message

sculpture.cpp:45:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 380 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 5 ms 380 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 5 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 6 ms 380 KB Output is correct
34 Correct 6 ms 376 KB Output is correct
35 Correct 6 ms 376 KB Output is correct
36 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 380 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 424 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 7 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 6 ms 376 KB Output is correct
29 Correct 5 ms 376 KB Output is correct
30 Correct 6 ms 376 KB Output is correct
31 Correct 6 ms 380 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 6 ms 376 KB Output is correct
34 Correct 7 ms 504 KB Output is correct
35 Correct 6 ms 376 KB Output is correct
36 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 5 ms 372 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 376 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 6 ms 376 KB Output is correct
23 Correct 6 ms 380 KB Output is correct
24 Correct 7 ms 376 KB Output is correct
25 Correct 8 ms 376 KB Output is correct
26 Correct 9 ms 380 KB Output is correct
27 Correct 11 ms 376 KB Output is correct
28 Correct 12 ms 376 KB Output is correct
29 Correct 13 ms 376 KB Output is correct
30 Correct 13 ms 376 KB Output is correct
31 Correct 13 ms 376 KB Output is correct
32 Correct 14 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 6 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 6 ms 376 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 5 ms 376 KB Output is correct
37 Correct 5 ms 376 KB Output is correct
38 Correct 5 ms 376 KB Output is correct
39 Correct 6 ms 376 KB Output is correct
40 Correct 5 ms 376 KB Output is correct
41 Correct 6 ms 376 KB Output is correct
42 Correct 6 ms 376 KB Output is correct
43 Correct 6 ms 376 KB Output is correct
44 Correct 6 ms 376 KB Output is correct
45 Correct 6 ms 376 KB Output is correct
46 Correct 6 ms 380 KB Output is correct
47 Correct 6 ms 376 KB Output is correct
48 Correct 8 ms 376 KB Output is correct
49 Correct 10 ms 376 KB Output is correct
50 Correct 10 ms 376 KB Output is correct
51 Correct 13 ms 376 KB Output is correct
52 Correct 13 ms 376 KB Output is correct
53 Correct 13 ms 376 KB Output is correct
54 Correct 13 ms 376 KB Output is correct
55 Correct 13 ms 376 KB Output is correct
56 Correct 9 ms 376 KB Output is correct
57 Correct 18 ms 380 KB Output is correct
58 Correct 22 ms 376 KB Output is correct
59 Correct 28 ms 376 KB Output is correct
60 Correct 28 ms 376 KB Output is correct
61 Correct 29 ms 376 KB Output is correct
62 Correct 27 ms 376 KB Output is correct
63 Correct 28 ms 376 KB Output is correct
64 Correct 9 ms 376 KB Output is correct
65 Correct 9 ms 376 KB Output is correct
66 Correct 13 ms 376 KB Output is correct
67 Correct 17 ms 376 KB Output is correct
68 Correct 24 ms 376 KB Output is correct
69 Correct 27 ms 376 KB Output is correct
70 Correct 30 ms 376 KB Output is correct
71 Correct 29 ms 376 KB Output is correct
72 Correct 28 ms 376 KB Output is correct
73 Correct 27 ms 380 KB Output is correct
74 Correct 28 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 5 ms 380 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 376 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 368 KB Output is correct
22 Correct 6 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 6 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 6 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 376 KB Output is correct
33 Correct 6 ms 376 KB Output is correct
34 Correct 6 ms 376 KB Output is correct
35 Correct 8 ms 376 KB Output is correct
36 Correct 9 ms 376 KB Output is correct
37 Correct 11 ms 376 KB Output is correct
38 Correct 13 ms 376 KB Output is correct
39 Correct 13 ms 376 KB Output is correct
40 Correct 14 ms 376 KB Output is correct
41 Correct 16 ms 376 KB Output is correct
42 Correct 13 ms 376 KB Output is correct
43 Correct 9 ms 376 KB Output is correct
44 Correct 19 ms 376 KB Output is correct
45 Correct 24 ms 376 KB Output is correct
46 Correct 30 ms 504 KB Output is correct
47 Correct 30 ms 376 KB Output is correct
48 Correct 28 ms 480 KB Output is correct
49 Correct 30 ms 376 KB Output is correct
50 Correct 30 ms 376 KB Output is correct
51 Correct 33 ms 376 KB Output is correct
52 Runtime error 6 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
53 Halted 0 ms 0 KB -