# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40905 | 2018-02-09T22:39:08 Z | IvanC | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 14840 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 102; unordered_set<ll> dp[MAXN][MAXN]; int N,A,B; ll soma[MAXN],best; ll calc(int a,int b){return soma[b] - soma[a-1];} void solve(int pos,int resta,ll curOr){ if(resta < 0) return; if(dp[pos][resta].count(curOr)) return; for(ll i = 0;(1LL <<i)<=curOr;i++){ if(curOr & (1LL << i)){ if(dp[pos][resta].count(curOr ^ (1LL << i))) return; } } dp[pos][resta].insert(curOr); if(pos == N + 1){ if(resta != 0) return; best = min(best,curOr); return; } if(resta == 0) return; for(int quebra = pos;quebra<=N;quebra++){ solve(quebra+1,resta - 1,curOr | calc(pos,quebra)); } } int main(){ scanf("%d %d %d",&N,&A,&B); for(int i = 1;i<=N;i++){ scanf("%lld",&soma[i]); soma[i] += soma[i-1]; } best = (ll)1e18; for(int i = A;i<=B;i++) solve(1,i,0); printf("%lld\n",best); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 888 KB | Output is correct |
2 | Correct | 2 ms | 888 KB | Output is correct |
3 | Correct | 2 ms | 936 KB | Output is correct |
4 | Correct | 2 ms | 1008 KB | Output is correct |
5 | Correct | 2 ms | 1080 KB | Output is correct |
6 | Correct | 2 ms | 1208 KB | Output is correct |
7 | Correct | 2 ms | 1208 KB | Output is correct |
8 | Correct | 2 ms | 1208 KB | Output is correct |
9 | Correct | 2 ms | 1208 KB | Output is correct |
10 | Correct | 2 ms | 1208 KB | Output is correct |
11 | Correct | 2 ms | 1208 KB | Output is correct |
12 | Correct | 2 ms | 1208 KB | Output is correct |
13 | Correct | 3 ms | 1260 KB | Output is correct |
14 | Correct | 2 ms | 1260 KB | Output is correct |
15 | Correct | 2 ms | 1260 KB | Output is correct |
16 | Correct | 2 ms | 1260 KB | Output is correct |
17 | Correct | 2 ms | 1260 KB | Output is correct |
18 | Correct | 2 ms | 1260 KB | Output is correct |
19 | Correct | 2 ms | 1260 KB | Output is correct |
20 | Correct | 2 ms | 1260 KB | Output is correct |
21 | Correct | 3 ms | 1260 KB | Output is correct |
22 | Correct | 3 ms | 1260 KB | Output is correct |
23 | Correct | 2 ms | 1260 KB | Output is correct |
24 | Correct | 2 ms | 1260 KB | Output is correct |
25 | Correct | 2 ms | 1260 KB | Output is correct |
26 | Correct | 3 ms | 1260 KB | Output is correct |
27 | Correct | 2 ms | 1260 KB | Output is correct |
28 | Correct | 3 ms | 1260 KB | Output is correct |
29 | Correct | 19 ms | 1516 KB | Output is correct |
30 | Correct | 3 ms | 1516 KB | Output is correct |
31 | Correct | 7 ms | 1516 KB | Output is correct |
32 | Correct | 2 ms | 1516 KB | Output is correct |
33 | Correct | 3 ms | 1516 KB | Output is correct |
34 | Correct | 3 ms | 1516 KB | Output is correct |
35 | Correct | 2 ms | 1516 KB | Output is correct |
36 | Correct | 2 ms | 1516 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1516 KB | Output is correct |
2 | Correct | 2 ms | 1516 KB | Output is correct |
3 | Correct | 2 ms | 1516 KB | Output is correct |
4 | Correct | 2 ms | 1516 KB | Output is correct |
5 | Correct | 2 ms | 1516 KB | Output is correct |
6 | Correct | 2 ms | 1516 KB | Output is correct |
7 | Correct | 2 ms | 1516 KB | Output is correct |
8 | Correct | 2 ms | 1516 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 2 ms | 1516 KB | Output is correct |
12 | Correct | 2 ms | 1516 KB | Output is correct |
13 | Correct | 4 ms | 1516 KB | Output is correct |
14 | Correct | 2 ms | 1516 KB | Output is correct |
15 | Correct | 2 ms | 1516 KB | Output is correct |
16 | Correct | 2 ms | 1516 KB | Output is correct |
17 | Correct | 2 ms | 1516 KB | Output is correct |
18 | Correct | 2 ms | 1516 KB | Output is correct |
19 | Correct | 2 ms | 1516 KB | Output is correct |
20 | Correct | 2 ms | 1516 KB | Output is correct |
21 | Correct | 3 ms | 1516 KB | Output is correct |
22 | Correct | 2 ms | 1516 KB | Output is correct |
23 | Correct | 3 ms | 1516 KB | Output is correct |
24 | Correct | 2 ms | 1516 KB | Output is correct |
25 | Correct | 2 ms | 1516 KB | Output is correct |
26 | Correct | 3 ms | 1516 KB | Output is correct |
27 | Correct | 4 ms | 1516 KB | Output is correct |
28 | Correct | 4 ms | 1516 KB | Output is correct |
29 | Correct | 4 ms | 1516 KB | Output is correct |
30 | Correct | 22 ms | 1900 KB | Output is correct |
31 | Correct | 83 ms | 3000 KB | Output is correct |
32 | Correct | 44 ms | 3000 KB | Output is correct |
33 | Correct | 2 ms | 3000 KB | Output is correct |
34 | Correct | 38 ms | 3000 KB | Output is correct |
35 | Correct | 34 ms | 3000 KB | Output is correct |
36 | Correct | 19 ms | 3000 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3000 KB | Output is correct |
2 | Correct | 2 ms | 3000 KB | Output is correct |
3 | Correct | 2 ms | 3000 KB | Output is correct |
4 | Correct | 2 ms | 3000 KB | Output is correct |
5 | Correct | 2 ms | 3000 KB | Output is correct |
6 | Correct | 2 ms | 3000 KB | Output is correct |
7 | Correct | 2 ms | 3000 KB | Output is correct |
8 | Correct | 2 ms | 3000 KB | Output is correct |
9 | Correct | 3 ms | 3000 KB | Output is correct |
10 | Correct | 2 ms | 3000 KB | Output is correct |
11 | Correct | 2 ms | 3000 KB | Output is correct |
12 | Correct | 2 ms | 3000 KB | Output is correct |
13 | Correct | 3 ms | 3000 KB | Output is correct |
14 | Correct | 4 ms | 3000 KB | Output is correct |
15 | Correct | 4 ms | 3000 KB | Output is correct |
16 | Correct | 4 ms | 3000 KB | Output is correct |
17 | Correct | 22 ms | 3000 KB | Output is correct |
18 | Correct | 76 ms | 3052 KB | Output is correct |
19 | Correct | 42 ms | 3052 KB | Output is correct |
20 | Correct | 2 ms | 3052 KB | Output is correct |
21 | Correct | 41 ms | 3052 KB | Output is correct |
22 | Correct | 35 ms | 3052 KB | Output is correct |
23 | Correct | 19 ms | 3052 KB | Output is correct |
24 | Correct | 92 ms | 3104 KB | Output is correct |
25 | Correct | 61 ms | 3104 KB | Output is correct |
26 | Correct | 410 ms | 7404 KB | Output is correct |
27 | Execution timed out | 1068 ms | 14576 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 14576 KB | Output is correct |
2 | Correct | 2 ms | 14576 KB | Output is correct |
3 | Correct | 2 ms | 14576 KB | Output is correct |
4 | Correct | 2 ms | 14576 KB | Output is correct |
5 | Correct | 2 ms | 14576 KB | Output is correct |
6 | Correct | 3 ms | 14576 KB | Output is correct |
7 | Correct | 3 ms | 14576 KB | Output is correct |
8 | Correct | 2 ms | 14576 KB | Output is correct |
9 | Correct | 2 ms | 14576 KB | Output is correct |
10 | Correct | 2 ms | 14576 KB | Output is correct |
11 | Correct | 2 ms | 14576 KB | Output is correct |
12 | Correct | 2 ms | 14576 KB | Output is correct |
13 | Correct | 3 ms | 14576 KB | Output is correct |
14 | Correct | 2 ms | 14576 KB | Output is correct |
15 | Correct | 2 ms | 14576 KB | Output is correct |
16 | Correct | 2 ms | 14576 KB | Output is correct |
17 | Correct | 2 ms | 14576 KB | Output is correct |
18 | Correct | 2 ms | 14576 KB | Output is correct |
19 | Correct | 2 ms | 14576 KB | Output is correct |
20 | Correct | 5 ms | 14576 KB | Output is correct |
21 | Correct | 3 ms | 14576 KB | Output is correct |
22 | Correct | 3 ms | 14576 KB | Output is correct |
23 | Correct | 2 ms | 14576 KB | Output is correct |
24 | Correct | 2 ms | 14576 KB | Output is correct |
25 | Correct | 3 ms | 14576 KB | Output is correct |
26 | Correct | 3 ms | 14576 KB | Output is correct |
27 | Correct | 2 ms | 14576 KB | Output is correct |
28 | Correct | 3 ms | 14576 KB | Output is correct |
29 | Correct | 25 ms | 14576 KB | Output is correct |
30 | Correct | 4 ms | 14576 KB | Output is correct |
31 | Correct | 6 ms | 14576 KB | Output is correct |
32 | Correct | 2 ms | 14576 KB | Output is correct |
33 | Correct | 3 ms | 14576 KB | Output is correct |
34 | Correct | 3 ms | 14576 KB | Output is correct |
35 | Correct | 2 ms | 14576 KB | Output is correct |
36 | Correct | 2 ms | 14576 KB | Output is correct |
37 | Correct | 4 ms | 14576 KB | Output is correct |
38 | Correct | 4 ms | 14576 KB | Output is correct |
39 | Correct | 4 ms | 14576 KB | Output is correct |
40 | Correct | 22 ms | 14576 KB | Output is correct |
41 | Correct | 82 ms | 14576 KB | Output is correct |
42 | Correct | 45 ms | 14576 KB | Output is correct |
43 | Correct | 2 ms | 14576 KB | Output is correct |
44 | Correct | 40 ms | 14576 KB | Output is correct |
45 | Correct | 35 ms | 14576 KB | Output is correct |
46 | Correct | 20 ms | 14576 KB | Output is correct |
47 | Correct | 77 ms | 14576 KB | Output is correct |
48 | Correct | 67 ms | 14576 KB | Output is correct |
49 | Correct | 456 ms | 14576 KB | Output is correct |
50 | Execution timed out | 1059 ms | 14576 KB | Time limit exceeded |
51 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 14576 KB | Output is correct |
2 | Correct | 2 ms | 14576 KB | Output is correct |
3 | Correct | 2 ms | 14576 KB | Output is correct |
4 | Correct | 2 ms | 14576 KB | Output is correct |
5 | Correct | 2 ms | 14576 KB | Output is correct |
6 | Correct | 2 ms | 14576 KB | Output is correct |
7 | Correct | 2 ms | 14576 KB | Output is correct |
8 | Correct | 2 ms | 14576 KB | Output is correct |
9 | Correct | 2 ms | 14576 KB | Output is correct |
10 | Correct | 2 ms | 14576 KB | Output is correct |
11 | Correct | 2 ms | 14576 KB | Output is correct |
12 | Correct | 2 ms | 14576 KB | Output is correct |
13 | Correct | 3 ms | 14576 KB | Output is correct |
14 | Correct | 3 ms | 14576 KB | Output is correct |
15 | Correct | 3 ms | 14576 KB | Output is correct |
16 | Correct | 19 ms | 14576 KB | Output is correct |
17 | Correct | 4 ms | 14576 KB | Output is correct |
18 | Correct | 6 ms | 14576 KB | Output is correct |
19 | Correct | 2 ms | 14576 KB | Output is correct |
20 | Correct | 3 ms | 14576 KB | Output is correct |
21 | Correct | 3 ms | 14576 KB | Output is correct |
22 | Correct | 2 ms | 14576 KB | Output is correct |
23 | Correct | 2 ms | 14576 KB | Output is correct |
24 | Correct | 4 ms | 14576 KB | Output is correct |
25 | Correct | 5 ms | 14576 KB | Output is correct |
26 | Correct | 4 ms | 14576 KB | Output is correct |
27 | Correct | 22 ms | 14576 KB | Output is correct |
28 | Correct | 73 ms | 14576 KB | Output is correct |
29 | Correct | 43 ms | 14576 KB | Output is correct |
30 | Correct | 2 ms | 14576 KB | Output is correct |
31 | Correct | 38 ms | 14576 KB | Output is correct |
32 | Correct | 35 ms | 14576 KB | Output is correct |
33 | Correct | 19 ms | 14576 KB | Output is correct |
34 | Correct | 82 ms | 14576 KB | Output is correct |
35 | Correct | 73 ms | 14576 KB | Output is correct |
36 | Correct | 414 ms | 14576 KB | Output is correct |
37 | Execution timed out | 1066 ms | 14840 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |