# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40904 | 2018-02-09T22:33:56 Z | IvanC | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 24592 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; 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 | 1064 KB | Output is correct |
4 | Correct | 3 ms | 1064 KB | Output is correct |
5 | Correct | 2 ms | 1064 KB | Output is correct |
6 | Correct | 2 ms | 1064 KB | Output is correct |
7 | Correct | 2 ms | 1064 KB | Output is correct |
8 | Correct | 2 ms | 1064 KB | Output is correct |
9 | Correct | 2 ms | 1064 KB | Output is correct |
10 | Correct | 2 ms | 1064 KB | Output is correct |
11 | Correct | 2 ms | 1064 KB | Output is correct |
12 | Correct | 2 ms | 1128 KB | Output is correct |
13 | Correct | 3 ms | 1240 KB | Output is correct |
14 | Correct | 2 ms | 1240 KB | Output is correct |
15 | Correct | 2 ms | 1240 KB | Output is correct |
16 | Correct | 2 ms | 1240 KB | Output is correct |
17 | Correct | 3 ms | 1240 KB | Output is correct |
18 | Correct | 2 ms | 1240 KB | Output is correct |
19 | Correct | 2 ms | 1240 KB | Output is correct |
20 | Correct | 2 ms | 1240 KB | Output is correct |
21 | Correct | 2 ms | 1240 KB | Output is correct |
22 | Correct | 3 ms | 1240 KB | Output is correct |
23 | Correct | 2 ms | 1240 KB | Output is correct |
24 | Correct | 2 ms | 1240 KB | Output is correct |
25 | Correct | 2 ms | 1240 KB | Output is correct |
26 | Correct | 3 ms | 1260 KB | Output is correct |
27 | Correct | 2 ms | 1260 KB | Output is correct |
28 | Correct | 2 ms | 1260 KB | Output is correct |
29 | Correct | 5 ms | 1644 KB | Output is correct |
30 | Correct | 3 ms | 1644 KB | Output is correct |
31 | Correct | 3 ms | 1644 KB | Output is correct |
32 | Correct | 2 ms | 1644 KB | Output is correct |
33 | Correct | 2 ms | 1644 KB | Output is correct |
34 | Correct | 2 ms | 1644 KB | Output is correct |
35 | Correct | 2 ms | 1644 KB | Output is correct |
36 | Correct | 2 ms | 1644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1644 KB | Output is correct |
2 | Correct | 2 ms | 1644 KB | Output is correct |
3 | Correct | 2 ms | 1644 KB | Output is correct |
4 | Correct | 2 ms | 1644 KB | Output is correct |
5 | Correct | 2 ms | 1644 KB | Output is correct |
6 | Correct | 2 ms | 1644 KB | Output is correct |
7 | Correct | 2 ms | 1644 KB | Output is correct |
8 | Correct | 2 ms | 1644 KB | Output is correct |
9 | Correct | 2 ms | 1644 KB | Output is correct |
10 | Correct | 2 ms | 1644 KB | Output is correct |
11 | Correct | 3 ms | 1644 KB | Output is correct |
12 | Correct | 2 ms | 1644 KB | Output is correct |
13 | Correct | 4 ms | 1644 KB | Output is correct |
14 | Correct | 2 ms | 1644 KB | Output is correct |
15 | Correct | 2 ms | 1644 KB | Output is correct |
16 | Correct | 2 ms | 1644 KB | Output is correct |
17 | Correct | 2 ms | 1644 KB | Output is correct |
18 | Correct | 2 ms | 1644 KB | Output is correct |
19 | Correct | 2 ms | 1644 KB | Output is correct |
20 | Correct | 2 ms | 1644 KB | Output is correct |
21 | Correct | 3 ms | 1644 KB | Output is correct |
22 | Correct | 2 ms | 1644 KB | Output is correct |
23 | Correct | 2 ms | 1644 KB | Output is correct |
24 | Correct | 2 ms | 1644 KB | Output is correct |
25 | Correct | 2 ms | 1644 KB | Output is correct |
26 | Correct | 3 ms | 1644 KB | Output is correct |
27 | Correct | 4 ms | 1644 KB | Output is correct |
28 | Correct | 3 ms | 1644 KB | Output is correct |
29 | Correct | 5 ms | 1644 KB | Output is correct |
30 | Correct | 17 ms | 2028 KB | Output is correct |
31 | Correct | 60 ms | 3436 KB | Output is correct |
32 | Correct | 34 ms | 3436 KB | Output is correct |
33 | Correct | 2 ms | 3436 KB | Output is correct |
34 | Correct | 28 ms | 3436 KB | Output is correct |
35 | Correct | 27 ms | 3436 KB | Output is correct |
36 | Correct | 16 ms | 3436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3436 KB | Output is correct |
2 | Correct | 3 ms | 3436 KB | Output is correct |
3 | Correct | 2 ms | 3436 KB | Output is correct |
4 | Correct | 2 ms | 3436 KB | Output is correct |
5 | Correct | 2 ms | 3436 KB | Output is correct |
6 | Correct | 2 ms | 3436 KB | Output is correct |
7 | Correct | 2 ms | 3436 KB | Output is correct |
8 | Correct | 2 ms | 3436 KB | Output is correct |
9 | Correct | 2 ms | 3436 KB | Output is correct |
10 | Correct | 2 ms | 3436 KB | Output is correct |
11 | Correct | 2 ms | 3436 KB | Output is correct |
12 | Correct | 2 ms | 3436 KB | Output is correct |
13 | Correct | 3 ms | 3436 KB | Output is correct |
14 | Correct | 4 ms | 3436 KB | Output is correct |
15 | Correct | 3 ms | 3436 KB | Output is correct |
16 | Correct | 4 ms | 3436 KB | Output is correct |
17 | Correct | 18 ms | 3436 KB | Output is correct |
18 | Correct | 54 ms | 3436 KB | Output is correct |
19 | Correct | 39 ms | 3436 KB | Output is correct |
20 | Correct | 2 ms | 3436 KB | Output is correct |
21 | Correct | 30 ms | 3436 KB | Output is correct |
22 | Correct | 28 ms | 3436 KB | Output is correct |
23 | Correct | 15 ms | 3436 KB | Output is correct |
24 | Correct | 56 ms | 3596 KB | Output is correct |
25 | Correct | 51 ms | 3596 KB | Output is correct |
26 | Correct | 310 ms | 8968 KB | Output is correct |
27 | Execution timed out | 1063 ms | 23600 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 23600 KB | Output is correct |
2 | Correct | 2 ms | 23600 KB | Output is correct |
3 | Correct | 2 ms | 23600 KB | Output is correct |
4 | Correct | 2 ms | 23600 KB | Output is correct |
5 | Correct | 2 ms | 23600 KB | Output is correct |
6 | Correct | 2 ms | 23600 KB | Output is correct |
7 | Correct | 2 ms | 23600 KB | Output is correct |
8 | Correct | 2 ms | 23600 KB | Output is correct |
9 | Correct | 2 ms | 23600 KB | Output is correct |
10 | Correct | 2 ms | 23600 KB | Output is correct |
11 | Correct | 2 ms | 23600 KB | Output is correct |
12 | Correct | 2 ms | 23600 KB | Output is correct |
13 | Correct | 4 ms | 23600 KB | Output is correct |
14 | Correct | 2 ms | 23600 KB | Output is correct |
15 | Correct | 2 ms | 23600 KB | Output is correct |
16 | Correct | 2 ms | 23600 KB | Output is correct |
17 | Correct | 3 ms | 23600 KB | Output is correct |
18 | Correct | 2 ms | 23600 KB | Output is correct |
19 | Correct | 2 ms | 23600 KB | Output is correct |
20 | Correct | 3 ms | 23600 KB | Output is correct |
21 | Correct | 2 ms | 23600 KB | Output is correct |
22 | Correct | 2 ms | 23600 KB | Output is correct |
23 | Correct | 2 ms | 23600 KB | Output is correct |
24 | Correct | 2 ms | 23600 KB | Output is correct |
25 | Correct | 2 ms | 23600 KB | Output is correct |
26 | Correct | 3 ms | 23600 KB | Output is correct |
27 | Correct | 2 ms | 23600 KB | Output is correct |
28 | Correct | 2 ms | 23600 KB | Output is correct |
29 | Correct | 5 ms | 23600 KB | Output is correct |
30 | Correct | 2 ms | 23600 KB | Output is correct |
31 | Correct | 3 ms | 23600 KB | Output is correct |
32 | Correct | 2 ms | 23600 KB | Output is correct |
33 | Correct | 2 ms | 23600 KB | Output is correct |
34 | Correct | 3 ms | 23600 KB | Output is correct |
35 | Correct | 2 ms | 23600 KB | Output is correct |
36 | Correct | 2 ms | 23600 KB | Output is correct |
37 | Correct | 4 ms | 23600 KB | Output is correct |
38 | Correct | 4 ms | 23600 KB | Output is correct |
39 | Correct | 4 ms | 23600 KB | Output is correct |
40 | Correct | 16 ms | 23600 KB | Output is correct |
41 | Correct | 57 ms | 23600 KB | Output is correct |
42 | Correct | 33 ms | 23600 KB | Output is correct |
43 | Correct | 2 ms | 23600 KB | Output is correct |
44 | Correct | 34 ms | 23600 KB | Output is correct |
45 | Correct | 28 ms | 23600 KB | Output is correct |
46 | Correct | 18 ms | 23600 KB | Output is correct |
47 | Correct | 54 ms | 23600 KB | Output is correct |
48 | Correct | 46 ms | 23600 KB | Output is correct |
49 | Correct | 303 ms | 23600 KB | Output is correct |
50 | Execution timed out | 1068 ms | 24592 KB | Time limit exceeded |
51 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 24592 KB | Output is correct |
2 | Correct | 2 ms | 24592 KB | Output is correct |
3 | Correct | 2 ms | 24592 KB | Output is correct |
4 | Correct | 2 ms | 24592 KB | Output is correct |
5 | Correct | 2 ms | 24592 KB | Output is correct |
6 | Correct | 2 ms | 24592 KB | Output is correct |
7 | Correct | 2 ms | 24592 KB | Output is correct |
8 | Correct | 2 ms | 24592 KB | Output is correct |
9 | Correct | 2 ms | 24592 KB | Output is correct |
10 | Correct | 2 ms | 24592 KB | Output is correct |
11 | Correct | 2 ms | 24592 KB | Output is correct |
12 | Correct | 2 ms | 24592 KB | Output is correct |
13 | Correct | 3 ms | 24592 KB | Output is correct |
14 | Correct | 2 ms | 24592 KB | Output is correct |
15 | Correct | 2 ms | 24592 KB | Output is correct |
16 | Correct | 5 ms | 24592 KB | Output is correct |
17 | Correct | 2 ms | 24592 KB | Output is correct |
18 | Correct | 3 ms | 24592 KB | Output is correct |
19 | Correct | 2 ms | 24592 KB | Output is correct |
20 | Correct | 3 ms | 24592 KB | Output is correct |
21 | Correct | 2 ms | 24592 KB | Output is correct |
22 | Correct | 2 ms | 24592 KB | Output is correct |
23 | Correct | 2 ms | 24592 KB | Output is correct |
24 | Correct | 3 ms | 24592 KB | Output is correct |
25 | Correct | 3 ms | 24592 KB | Output is correct |
26 | Correct | 4 ms | 24592 KB | Output is correct |
27 | Correct | 17 ms | 24592 KB | Output is correct |
28 | Correct | 55 ms | 24592 KB | Output is correct |
29 | Correct | 35 ms | 24592 KB | Output is correct |
30 | Correct | 2 ms | 24592 KB | Output is correct |
31 | Correct | 29 ms | 24592 KB | Output is correct |
32 | Correct | 29 ms | 24592 KB | Output is correct |
33 | Correct | 16 ms | 24592 KB | Output is correct |
34 | Correct | 55 ms | 24592 KB | Output is correct |
35 | Correct | 47 ms | 24592 KB | Output is correct |
36 | Correct | 284 ms | 24592 KB | Output is correct |
37 | Execution timed out | 1061 ms | 24592 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |