Submission #101322

# Submission time Handle Problem Language Result Execution time Memory
101322 2019-03-18T12:50:23 Z arman_ferdous Bali Sculptures (APIO15_sculpture) C++17
71 / 100
67 ms 512 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
const int N = 2010;

int n, A, B;
ll a[N], mask, bitpos;

int dp4[105][105], dp5[N];
int DP4(int pos, int parts) {
	if(pos > n) {
		if(A <= parts && parts <= B) return 1;
		return 0;
	}
	if(dp4[pos][parts] != -1) return dp4[pos][parts];

	int &ret = dp4[pos][parts]; ret = 0;
	ll s = 0;
	for(int i = pos; i <= n; i++) {
		s += a[i];
		if(((mask >> bitpos) & (s >> bitpos)) == (s>>bitpos)) ret |= DP4(i+1, parts+1);
	}
	return ret;
}

int main() {
	scanf("%d %d %d", &n, &A, &B);
	for(int i = 1; i <= n; i++)
		scanf("%lld", &a[i]);
	if(n <= 100) {	
		for(bitpos = 45; bitpos >= 0; bitpos--) {
			memset(dp4, -1, sizeof dp4);
			if(!DP4(1,0)) mask |= (1ll<<bitpos);
		}
		printf("%lld\n", mask);
		return 0;
	}
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &A, &B);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &a[i]);
   ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct
33 Correct 3 ms 408 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 3 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 4 ms 412 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 4 ms 384 KB Output is correct
28 Correct 3 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 6 ms 384 KB Output is correct
31 Correct 8 ms 384 KB Output is correct
32 Correct 8 ms 384 KB Output is correct
33 Correct 10 ms 384 KB Output is correct
34 Correct 9 ms 384 KB Output is correct
35 Correct 9 ms 384 KB Output is correct
36 Correct 8 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 6 ms 356 KB Output is correct
17 Correct 6 ms 384 KB Output is correct
18 Correct 11 ms 384 KB Output is correct
19 Correct 9 ms 384 KB Output is correct
20 Correct 8 ms 384 KB Output is correct
21 Correct 8 ms 384 KB Output is correct
22 Correct 11 ms 384 KB Output is correct
23 Correct 8 ms 384 KB Output is correct
24 Correct 7 ms 384 KB Output is correct
25 Correct 22 ms 384 KB Output is correct
26 Correct 23 ms 384 KB Output is correct
27 Correct 34 ms 384 KB Output is correct
28 Correct 67 ms 384 KB Output is correct
29 Correct 51 ms 444 KB Output is correct
30 Correct 45 ms 384 KB Output is correct
31 Correct 43 ms 384 KB Output is correct
32 Correct 51 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 3 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 3 ms 384 KB Output is correct
34 Correct 2 ms 356 KB Output is correct
35 Correct 3 ms 384 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 3 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 8 ms 384 KB Output is correct
41 Correct 12 ms 384 KB Output is correct
42 Correct 10 ms 384 KB Output is correct
43 Correct 9 ms 384 KB Output is correct
44 Correct 11 ms 384 KB Output is correct
45 Correct 9 ms 384 KB Output is correct
46 Correct 9 ms 384 KB Output is correct
47 Correct 8 ms 384 KB Output is correct
48 Correct 14 ms 432 KB Output is correct
49 Correct 27 ms 356 KB Output is correct
50 Correct 34 ms 384 KB Output is correct
51 Correct 59 ms 384 KB Output is correct
52 Correct 51 ms 384 KB Output is correct
53 Correct 52 ms 444 KB Output is correct
54 Correct 51 ms 384 KB Output is correct
55 Correct 43 ms 384 KB Output is correct
56 Correct 5 ms 384 KB Output is correct
57 Correct 11 ms 384 KB Output is correct
58 Correct 13 ms 384 KB Output is correct
59 Correct 18 ms 384 KB Output is correct
60 Correct 18 ms 384 KB Output is correct
61 Correct 24 ms 384 KB Output is correct
62 Correct 29 ms 384 KB Output is correct
63 Correct 20 ms 384 KB Output is correct
64 Correct 53 ms 384 KB Output is correct
65 Correct 4 ms 384 KB Output is correct
66 Correct 8 ms 384 KB Output is correct
67 Correct 15 ms 384 KB Output is correct
68 Correct 13 ms 384 KB Output is correct
69 Correct 17 ms 384 KB Output is correct
70 Correct 15 ms 384 KB Output is correct
71 Correct 25 ms 384 KB Output is correct
72 Correct 24 ms 444 KB Output is correct
73 Correct 21 ms 384 KB Output is correct
74 Correct 31 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 9 ms 384 KB Output is correct
29 Correct 8 ms 384 KB Output is correct
30 Correct 9 ms 384 KB Output is correct
31 Correct 11 ms 384 KB Output is correct
32 Correct 11 ms 384 KB Output is correct
33 Correct 9 ms 384 KB Output is correct
34 Correct 12 ms 384 KB Output is correct
35 Correct 21 ms 384 KB Output is correct
36 Correct 34 ms 384 KB Output is correct
37 Correct 57 ms 384 KB Output is correct
38 Correct 44 ms 384 KB Output is correct
39 Correct 41 ms 384 KB Output is correct
40 Correct 45 ms 408 KB Output is correct
41 Correct 40 ms 384 KB Output is correct
42 Correct 45 ms 384 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 10 ms 384 KB Output is correct
45 Correct 12 ms 412 KB Output is correct
46 Correct 24 ms 384 KB Output is correct
47 Correct 25 ms 384 KB Output is correct
48 Correct 17 ms 384 KB Output is correct
49 Correct 19 ms 384 KB Output is correct
50 Correct 22 ms 384 KB Output is correct
51 Incorrect 2 ms 256 KB Output isn't correct
52 Halted 0 ms 0 KB -