답안 #131009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131009 2019-07-16T11:14:21 Z someone_aa Bali Sculptures (APIO15_sculpture) C++17
50 / 100
160 ms 504 KB
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 2100;
ll n, a, b;
ll arr[maxn];
ll dp[maxn];

bool check(ll mask) {
	dp[0] = 0LL;
	for(int i=1;i<=n;i++) {
		ll sum = 0LL;

		dp[i] = INT_MAX;
		for(int lst=i;lst>=1;lst--) {
			sum += arr[lst];
			if((sum & mask) == sum) dp[i] = min(dp[i], dp[lst-1] + 1);
		}
	}

	return dp[n] <= b;
}

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


	ll mask = 0LL;
	for(ll bit=50LL;bit>=0;bit--) {
		ll temp_mask = mask + ((1LL<<bit) - 1);
		//cout<<temp_mask<<": "<<check(temp_mask)<<"\n";
		if(!check(temp_mask)) mask += (1LL<<bit);
	}
	cout<<mask<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 1 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 1 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Incorrect 2 ms 256 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 292 KB Output is correct
11 Correct 2 ms 396 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 368 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 392 KB Output is correct
21 Correct 2 ms 360 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 356 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 396 KB Output is correct
27 Correct 3 ms 256 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
29 Correct 3 ms 348 KB Output is correct
30 Correct 3 ms 392 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 252 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 396 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 420 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Incorrect 2 ms 392 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 292 KB Output is correct
6 Correct 10 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 308 KB Output is correct
9 Correct 2 ms 368 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 312 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 2 ms 400 KB Output is correct
31 Correct 3 ms 256 KB Output is correct
32 Correct 2 ms 252 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 2 ms 424 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 3 ms 256 KB Output is correct
38 Correct 3 ms 376 KB Output is correct
39 Correct 3 ms 376 KB Output is correct
40 Correct 3 ms 376 KB Output is correct
41 Correct 3 ms 380 KB Output is correct
42 Correct 3 ms 376 KB Output is correct
43 Correct 3 ms 400 KB Output is correct
44 Correct 3 ms 376 KB Output is correct
45 Correct 3 ms 256 KB Output is correct
46 Correct 3 ms 376 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 3 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 6 ms 376 KB Output is correct
51 Correct 3 ms 256 KB Output is correct
52 Correct 17 ms 376 KB Output is correct
53 Correct 25 ms 504 KB Output is correct
54 Correct 44 ms 380 KB Output is correct
55 Correct 43 ms 376 KB Output is correct
56 Correct 155 ms 284 KB Output is correct
57 Correct 157 ms 408 KB Output is correct
58 Correct 149 ms 404 KB Output is correct
59 Correct 157 ms 412 KB Output is correct
60 Correct 160 ms 408 KB Output is correct
61 Correct 3 ms 376 KB Output is correct
62 Correct 25 ms 376 KB Output is correct
63 Correct 45 ms 376 KB Output is correct
64 Correct 42 ms 420 KB Output is correct
65 Correct 78 ms 376 KB Output is correct
66 Correct 117 ms 504 KB Output is correct
67 Correct 154 ms 504 KB Output is correct
68 Correct 157 ms 376 KB Output is correct
69 Correct 152 ms 376 KB Output is correct