# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
219962 | 2020-04-06T18:05:56 Z | MKopchev | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 4600 KB |
#include<bits/stdc++.h> using namespace std; const int nmax=2e3+42; int n,a,b,inp[nmax]; long long pref[nmax]; long long current; bool possible; bool been[nmax][nmax]; void dfs(int groups,int last_end) { if(possible)return; if(groups>b)return; if(last_end==n) { if(groups>=a)possible=1; return; } if(been[groups][last_end])return; been[groups][last_end]=1; for(int j=last_end+1;j<=n;j++) { long long sum=pref[j]-pref[last_end]; if((current&sum)==sum)dfs(groups+1,j); } } bool can(long long to_test) { current=to_test; memset(been,0,sizeof(been)); possible=0; dfs(0,0); return possible; } int main() { scanf("%i%i%i",&n,&a,&b); for(int i=1;i<=n;i++)scanf("%i",&inp[i]); for(int i=1;i<=n;i++)pref[i]=pref[i-1]+inp[i]; long long output=(1LL<<41)-1; for(int i=40;i>=0;i--) if(can(output-(1LL<<i)))output=output-(1LL<<i); printf("%lld\n",output); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 4480 KB | Output is correct |
2 | Correct | 11 ms | 4352 KB | Output is correct |
3 | Correct | 11 ms | 4352 KB | Output is correct |
4 | Correct | 11 ms | 4352 KB | Output is correct |
5 | Correct | 11 ms | 4352 KB | Output is correct |
6 | Correct | 15 ms | 4480 KB | Output is correct |
7 | Correct | 12 ms | 4480 KB | Output is correct |
8 | Correct | 12 ms | 4352 KB | Output is correct |
9 | Correct | 11 ms | 4352 KB | Output is correct |
10 | Correct | 11 ms | 4352 KB | Output is correct |
11 | Correct | 11 ms | 4352 KB | Output is correct |
12 | Correct | 12 ms | 4352 KB | Output is correct |
13 | Correct | 11 ms | 4352 KB | Output is correct |
14 | Correct | 12 ms | 4352 KB | Output is correct |
15 | Correct | 12 ms | 4480 KB | Output is correct |
16 | Correct | 11 ms | 4480 KB | Output is correct |
17 | Correct | 11 ms | 4352 KB | Output is correct |
18 | Correct | 12 ms | 4352 KB | Output is correct |
19 | Correct | 12 ms | 4352 KB | Output is correct |
20 | Correct | 13 ms | 4480 KB | Output is correct |
21 | Correct | 11 ms | 4352 KB | Output is correct |
22 | Correct | 11 ms | 4352 KB | Output is correct |
23 | Correct | 12 ms | 4352 KB | Output is correct |
24 | Correct | 12 ms | 4352 KB | Output is correct |
25 | Correct | 11 ms | 4352 KB | Output is correct |
26 | Correct | 11 ms | 4352 KB | Output is correct |
27 | Correct | 11 ms | 4352 KB | Output is correct |
28 | Correct | 12 ms | 4352 KB | Output is correct |
29 | Correct | 11 ms | 4480 KB | Output is correct |
30 | Correct | 12 ms | 4352 KB | Output is correct |
31 | Correct | 12 ms | 4352 KB | Output is correct |
32 | Correct | 11 ms | 4352 KB | Output is correct |
33 | Correct | 11 ms | 4352 KB | Output is correct |
34 | Correct | 12 ms | 4352 KB | Output is correct |
35 | Correct | 18 ms | 4352 KB | Output is correct |
36 | Correct | 11 ms | 4352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4352 KB | Output is correct |
2 | Correct | 12 ms | 4352 KB | Output is correct |
3 | Correct | 13 ms | 4352 KB | Output is correct |
4 | Correct | 14 ms | 4352 KB | Output is correct |
5 | Correct | 19 ms | 4352 KB | Output is correct |
6 | Correct | 11 ms | 4352 KB | Output is correct |
7 | Correct | 12 ms | 4352 KB | Output is correct |
8 | Correct | 12 ms | 4352 KB | Output is correct |
9 | Correct | 14 ms | 4352 KB | Output is correct |
10 | Correct | 12 ms | 4352 KB | Output is correct |
11 | Correct | 12 ms | 4352 KB | Output is correct |
12 | Correct | 12 ms | 4352 KB | Output is correct |
13 | Correct | 12 ms | 4352 KB | Output is correct |
14 | Correct | 14 ms | 4352 KB | Output is correct |
15 | Correct | 13 ms | 4352 KB | Output is correct |
16 | Correct | 13 ms | 4352 KB | Output is correct |
17 | Correct | 12 ms | 4352 KB | Output is correct |
18 | Correct | 14 ms | 4400 KB | Output is correct |
19 | Correct | 12 ms | 4352 KB | Output is correct |
20 | Correct | 12 ms | 4352 KB | Output is correct |
21 | Correct | 12 ms | 4352 KB | Output is correct |
22 | Correct | 12 ms | 4344 KB | Output is correct |
23 | Correct | 11 ms | 4352 KB | Output is correct |
24 | Correct | 11 ms | 4352 KB | Output is correct |
25 | Correct | 11 ms | 4480 KB | Output is correct |
26 | Correct | 16 ms | 4480 KB | Output is correct |
27 | Correct | 11 ms | 4352 KB | Output is correct |
28 | Correct | 12 ms | 4352 KB | Output is correct |
29 | Correct | 12 ms | 4352 KB | Output is correct |
30 | Correct | 12 ms | 4352 KB | Output is correct |
31 | Correct | 12 ms | 4352 KB | Output is correct |
32 | Correct | 12 ms | 4352 KB | Output is correct |
33 | Correct | 11 ms | 4352 KB | Output is correct |
34 | Correct | 12 ms | 4480 KB | Output is correct |
35 | Correct | 12 ms | 4352 KB | Output is correct |
36 | Correct | 12 ms | 4352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4352 KB | Output is correct |
2 | Correct | 11 ms | 4352 KB | Output is correct |
3 | Correct | 11 ms | 4352 KB | Output is correct |
4 | Correct | 11 ms | 4352 KB | Output is correct |
5 | Correct | 12 ms | 4352 KB | Output is correct |
6 | Correct | 12 ms | 4352 KB | Output is correct |
7 | Correct | 12 ms | 4352 KB | Output is correct |
8 | Correct | 12 ms | 4480 KB | Output is correct |
9 | Correct | 12 ms | 4480 KB | Output is correct |
10 | Correct | 12 ms | 4480 KB | Output is correct |
11 | Correct | 15 ms | 4480 KB | Output is correct |
12 | Correct | 11 ms | 4352 KB | Output is correct |
13 | Correct | 11 ms | 4352 KB | Output is correct |
14 | Correct | 12 ms | 4480 KB | Output is correct |
15 | Correct | 12 ms | 4352 KB | Output is correct |
16 | Correct | 12 ms | 4352 KB | Output is correct |
17 | Correct | 12 ms | 4480 KB | Output is correct |
18 | Correct | 12 ms | 4352 KB | Output is correct |
19 | Correct | 12 ms | 4480 KB | Output is correct |
20 | Correct | 12 ms | 4480 KB | Output is correct |
21 | Correct | 12 ms | 4480 KB | Output is correct |
22 | Correct | 12 ms | 4352 KB | Output is correct |
23 | Correct | 12 ms | 4352 KB | Output is correct |
24 | Correct | 12 ms | 4352 KB | Output is correct |
25 | Correct | 12 ms | 4352 KB | Output is correct |
26 | Correct | 12 ms | 4352 KB | Output is correct |
27 | Correct | 13 ms | 4352 KB | Output is correct |
28 | Correct | 12 ms | 4352 KB | Output is correct |
29 | Correct | 12 ms | 4480 KB | Output is correct |
30 | Correct | 13 ms | 4480 KB | Output is correct |
31 | Correct | 12 ms | 4480 KB | Output is correct |
32 | Correct | 13 ms | 4352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 4352 KB | Output is correct |
2 | Correct | 11 ms | 4352 KB | Output is correct |
3 | Correct | 12 ms | 4352 KB | Output is correct |
4 | Correct | 12 ms | 4352 KB | Output is correct |
5 | Correct | 12 ms | 4352 KB | Output is correct |
6 | Correct | 12 ms | 4480 KB | Output is correct |
7 | Correct | 15 ms | 4480 KB | Output is correct |
8 | Correct | 12 ms | 4480 KB | Output is correct |
9 | Correct | 12 ms | 4352 KB | Output is correct |
10 | Correct | 12 ms | 4352 KB | Output is correct |
11 | Correct | 13 ms | 4352 KB | Output is correct |
12 | Correct | 13 ms | 4352 KB | Output is correct |
13 | Correct | 15 ms | 4480 KB | Output is correct |
14 | Correct | 11 ms | 4352 KB | Output is correct |
15 | Correct | 11 ms | 4352 KB | Output is correct |
16 | Correct | 12 ms | 4480 KB | Output is correct |
17 | Correct | 12 ms | 4352 KB | Output is correct |
18 | Correct | 12 ms | 4352 KB | Output is correct |
19 | Correct | 11 ms | 4480 KB | Output is correct |
20 | Correct | 11 ms | 4352 KB | Output is correct |
21 | Correct | 13 ms | 4352 KB | Output is correct |
22 | Correct | 12 ms | 4352 KB | Output is correct |
23 | Correct | 12 ms | 4352 KB | Output is correct |
24 | Correct | 12 ms | 4352 KB | Output is correct |
25 | Correct | 12 ms | 4352 KB | Output is correct |
26 | Correct | 15 ms | 4352 KB | Output is correct |
27 | Correct | 11 ms | 4480 KB | Output is correct |
28 | Correct | 12 ms | 4352 KB | Output is correct |
29 | Correct | 12 ms | 4352 KB | Output is correct |
30 | Correct | 11 ms | 4352 KB | Output is correct |
31 | Correct | 12 ms | 4352 KB | Output is correct |
32 | Correct | 12 ms | 4352 KB | Output is correct |
33 | Correct | 11 ms | 4352 KB | Output is correct |
34 | Correct | 12 ms | 4352 KB | Output is correct |
35 | Correct | 12 ms | 4480 KB | Output is correct |
36 | Correct | 12 ms | 4352 KB | Output is correct |
37 | Correct | 12 ms | 4480 KB | Output is correct |
38 | Correct | 12 ms | 4352 KB | Output is correct |
39 | Correct | 11 ms | 4352 KB | Output is correct |
40 | Correct | 17 ms | 4480 KB | Output is correct |
41 | Correct | 12 ms | 4480 KB | Output is correct |
42 | Correct | 12 ms | 4352 KB | Output is correct |
43 | Correct | 11 ms | 4352 KB | Output is correct |
44 | Correct | 12 ms | 4352 KB | Output is correct |
45 | Correct | 12 ms | 4352 KB | Output is correct |
46 | Correct | 12 ms | 4352 KB | Output is correct |
47 | Correct | 12 ms | 4352 KB | Output is correct |
48 | Correct | 12 ms | 4352 KB | Output is correct |
49 | Correct | 12 ms | 4352 KB | Output is correct |
50 | Correct | 12 ms | 4352 KB | Output is correct |
51 | Correct | 13 ms | 4480 KB | Output is correct |
52 | Correct | 13 ms | 4352 KB | Output is correct |
53 | Correct | 13 ms | 4352 KB | Output is correct |
54 | Correct | 12 ms | 4352 KB | Output is correct |
55 | Correct | 13 ms | 4352 KB | Output is correct |
56 | Correct | 11 ms | 4352 KB | Output is correct |
57 | Correct | 12 ms | 4352 KB | Output is correct |
58 | Correct | 12 ms | 4352 KB | Output is correct |
59 | Correct | 12 ms | 4480 KB | Output is correct |
60 | Correct | 12 ms | 4352 KB | Output is correct |
61 | Correct | 12 ms | 4352 KB | Output is correct |
62 | Correct | 12 ms | 4352 KB | Output is correct |
63 | Correct | 13 ms | 4480 KB | Output is correct |
64 | Correct | 12 ms | 4352 KB | Output is correct |
65 | Correct | 12 ms | 4352 KB | Output is correct |
66 | Correct | 12 ms | 4352 KB | Output is correct |
67 | Correct | 12 ms | 4352 KB | Output is correct |
68 | Correct | 12 ms | 4352 KB | Output is correct |
69 | Correct | 12 ms | 4480 KB | Output is correct |
70 | Correct | 12 ms | 4384 KB | Output is correct |
71 | Correct | 12 ms | 4352 KB | Output is correct |
72 | Correct | 12 ms | 4352 KB | Output is correct |
73 | Correct | 13 ms | 4352 KB | Output is correct |
74 | Correct | 12 ms | 4352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4352 KB | Output is correct |
2 | Correct | 12 ms | 4352 KB | Output is correct |
3 | Correct | 14 ms | 4352 KB | Output is correct |
4 | Correct | 15 ms | 4480 KB | Output is correct |
5 | Correct | 12 ms | 4480 KB | Output is correct |
6 | Correct | 12 ms | 4352 KB | Output is correct |
7 | Correct | 12 ms | 4352 KB | Output is correct |
8 | Correct | 11 ms | 4352 KB | Output is correct |
9 | Correct | 12 ms | 4480 KB | Output is correct |
10 | Correct | 11 ms | 4352 KB | Output is correct |
11 | Correct | 11 ms | 4352 KB | Output is correct |
12 | Correct | 11 ms | 4352 KB | Output is correct |
13 | Correct | 11 ms | 4352 KB | Output is correct |
14 | Correct | 11 ms | 4352 KB | Output is correct |
15 | Correct | 11 ms | 4352 KB | Output is correct |
16 | Correct | 12 ms | 4352 KB | Output is correct |
17 | Correct | 14 ms | 4480 KB | Output is correct |
18 | Correct | 12 ms | 4480 KB | Output is correct |
19 | Correct | 11 ms | 4352 KB | Output is correct |
20 | Correct | 11 ms | 4352 KB | Output is correct |
21 | Correct | 11 ms | 4352 KB | Output is correct |
22 | Correct | 12 ms | 4352 KB | Output is correct |
23 | Correct | 12 ms | 4352 KB | Output is correct |
24 | Correct | 12 ms | 4352 KB | Output is correct |
25 | Correct | 12 ms | 4352 KB | Output is correct |
26 | Correct | 12 ms | 4352 KB | Output is correct |
27 | Correct | 12 ms | 4480 KB | Output is correct |
28 | Correct | 12 ms | 4352 KB | Output is correct |
29 | Correct | 12 ms | 4352 KB | Output is correct |
30 | Correct | 11 ms | 4352 KB | Output is correct |
31 | Correct | 12 ms | 4352 KB | Output is correct |
32 | Correct | 12 ms | 4352 KB | Output is correct |
33 | Correct | 12 ms | 4480 KB | Output is correct |
34 | Correct | 11 ms | 4352 KB | Output is correct |
35 | Correct | 12 ms | 4352 KB | Output is correct |
36 | Correct | 12 ms | 4352 KB | Output is correct |
37 | Correct | 12 ms | 4352 KB | Output is correct |
38 | Correct | 12 ms | 4352 KB | Output is correct |
39 | Correct | 12 ms | 4480 KB | Output is correct |
40 | Correct | 12 ms | 4352 KB | Output is correct |
41 | Correct | 13 ms | 4480 KB | Output is correct |
42 | Correct | 12 ms | 4352 KB | Output is correct |
43 | Correct | 13 ms | 4352 KB | Output is correct |
44 | Correct | 12 ms | 4352 KB | Output is correct |
45 | Correct | 12 ms | 4352 KB | Output is correct |
46 | Correct | 12 ms | 4352 KB | Output is correct |
47 | Correct | 12 ms | 4480 KB | Output is correct |
48 | Correct | 12 ms | 4352 KB | Output is correct |
49 | Correct | 12 ms | 4352 KB | Output is correct |
50 | Correct | 13 ms | 4352 KB | Output is correct |
51 | Correct | 12 ms | 4352 KB | Output is correct |
52 | Correct | 142 ms | 4352 KB | Output is correct |
53 | Correct | 18 ms | 4480 KB | Output is correct |
54 | Correct | 284 ms | 4472 KB | Output is correct |
55 | Correct | 261 ms | 4472 KB | Output is correct |
56 | Correct | 833 ms | 4600 KB | Output is correct |
57 | Correct | 52 ms | 4480 KB | Output is correct |
58 | Correct | 63 ms | 4480 KB | Output is correct |
59 | Correct | 86 ms | 4480 KB | Output is correct |
60 | Correct | 31 ms | 4480 KB | Output is correct |
61 | Correct | 13 ms | 4352 KB | Output is correct |
62 | Correct | 19 ms | 4480 KB | Output is correct |
63 | Correct | 302 ms | 4472 KB | Output is correct |
64 | Correct | 24 ms | 4480 KB | Output is correct |
65 | Correct | 473 ms | 4480 KB | Output is correct |
66 | Correct | 41 ms | 4480 KB | Output is correct |
67 | Correct | 29 ms | 4480 KB | Output is correct |
68 | Execution timed out | 1093 ms | 4480 KB | Time limit exceeded |
69 | Halted | 0 ms | 0 KB | - |