Submission #453009

# Submission time Handle Problem Language Result Execution time Memory
453009 2021-08-04T07:28:09 Z nonsensenonsense1 Bali Sculptures (APIO15_sculpture) C++17
71 / 100
53 ms 332 KB
#include <cstdio>

const int LG = 60;
const int N = 100;
int n, a, b, y[N];
bool d[N + 1][N + 1];

bool test(long long x, int l) 
{
	for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j) {
		d[i][j] = 0;
		long long s = 0;
		for (int k = i - 1; k >= 0; --k) {
			s += y[k];
			if (((x | s) & ~(((long long)1 << l) - 1)) == x) d[i][j] = d[i][j] || d[k][j - 1];
		}
		if (i == n && j >= a && j <= b && d[i][j]) return true;
	}
	return false;
}

int main() 
{
	scanf("%d%d%d", &n, &a, &b);
	for (int i = 0; i < n; ++i) scanf("%d", y + i);
	long long ans = 0;
	d[0][0] = 1;
	for (int i = LG - 1; i >= 0; --i) if (!test(ans, i)) ans |= (long long)1 << i;
	printf("%lld\n", ans);
	return 0;
}

Compilation message

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