# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74283 | 2018-08-30T19:55:31 Z | Vardanyan | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 114032 KB |
#pragma GCC optimize "-O3" #include <bits/stdc++.h> using namespace std; const int N = 2005; int A[N]; int K; int n; vector<long long> dp[N][N]; int main() { int a,b; scanf("%d%d%d",&n,&a,&b); for(int i = 1;i<=n;i++) scanf("%d",&A[i]); long long c = 0; for(int i = 1;i<=n;i++){ c+=A[i]; dp[i][1].push_back(c); } long long ans = 10000000000000007; for(int k = 2;k<=b;k++){ for(int i = 1;i<=n;i++){ c = A[i]; unordered_map<long long,int> mp; for(int j = i-1;j>=1;j--){ for(int q = 0;q<dp[j][k-1].size();q++){ if(!mp[dp[j][k-1][q]|c]){ dp[i][k].push_back(dp[j][k-1][q]|c); // if(k>=a && i == n) ans = min(ans,dp[j][k-1][q]|c); mp[dp[j][k-1][q]|c] = 1; } } c+=A[j]; } } } for(int i = a;i<=b;i++){ for(int j = 0;j<dp[n][i].size();j++){ ans = min(ans,dp[n][i][j]); } } cout<<ans<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 94712 KB | Output is correct |
2 | Correct | 94 ms | 94836 KB | Output is correct |
3 | Correct | 85 ms | 94912 KB | Output is correct |
4 | Correct | 84 ms | 94912 KB | Output is correct |
5 | Correct | 86 ms | 94912 KB | Output is correct |
6 | Correct | 88 ms | 94912 KB | Output is correct |
7 | Correct | 84 ms | 94912 KB | Output is correct |
8 | Correct | 85 ms | 94912 KB | Output is correct |
9 | Correct | 85 ms | 94912 KB | Output is correct |
10 | Correct | 86 ms | 94912 KB | Output is correct |
11 | Correct | 90 ms | 94988 KB | Output is correct |
12 | Correct | 92 ms | 94988 KB | Output is correct |
13 | Correct | 94 ms | 94988 KB | Output is correct |
14 | Correct | 84 ms | 94988 KB | Output is correct |
15 | Correct | 84 ms | 94988 KB | Output is correct |
16 | Correct | 87 ms | 94988 KB | Output is correct |
17 | Correct | 89 ms | 95024 KB | Output is correct |
18 | Correct | 85 ms | 95024 KB | Output is correct |
19 | Correct | 87 ms | 95024 KB | Output is correct |
20 | Correct | 85 ms | 95024 KB | Output is correct |
21 | Correct | 86 ms | 95024 KB | Output is correct |
22 | Correct | 85 ms | 95024 KB | Output is correct |
23 | Correct | 85 ms | 95064 KB | Output is correct |
24 | Correct | 84 ms | 95064 KB | Output is correct |
25 | Correct | 84 ms | 95064 KB | Output is correct |
26 | Correct | 85 ms | 95064 KB | Output is correct |
27 | Correct | 86 ms | 95064 KB | Output is correct |
28 | Correct | 85 ms | 95064 KB | Output is correct |
29 | Correct | 86 ms | 95200 KB | Output is correct |
30 | Correct | 84 ms | 95200 KB | Output is correct |
31 | Correct | 91 ms | 95200 KB | Output is correct |
32 | Correct | 85 ms | 95200 KB | Output is correct |
33 | Correct | 86 ms | 95200 KB | Output is correct |
34 | Correct | 86 ms | 95200 KB | Output is correct |
35 | Correct | 86 ms | 95200 KB | Output is correct |
36 | Correct | 85 ms | 95200 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 95200 KB | Output is correct |
2 | Correct | 84 ms | 95200 KB | Output is correct |
3 | Correct | 86 ms | 95200 KB | Output is correct |
4 | Correct | 86 ms | 95200 KB | Output is correct |
5 | Correct | 85 ms | 95200 KB | Output is correct |
6 | Correct | 85 ms | 95200 KB | Output is correct |
7 | Correct | 104 ms | 95200 KB | Output is correct |
8 | Correct | 84 ms | 95200 KB | Output is correct |
9 | Correct | 88 ms | 95200 KB | Output is correct |
10 | Correct | 89 ms | 95200 KB | Output is correct |
11 | Correct | 95 ms | 95200 KB | Output is correct |
12 | Correct | 88 ms | 95200 KB | Output is correct |
13 | Correct | 89 ms | 95200 KB | Output is correct |
14 | Correct | 84 ms | 95200 KB | Output is correct |
15 | Correct | 87 ms | 95200 KB | Output is correct |
16 | Correct | 88 ms | 95200 KB | Output is correct |
17 | Correct | 85 ms | 95204 KB | Output is correct |
18 | Correct | 90 ms | 95204 KB | Output is correct |
19 | Correct | 85 ms | 95204 KB | Output is correct |
20 | Correct | 87 ms | 95204 KB | Output is correct |
21 | Correct | 90 ms | 95204 KB | Output is correct |
22 | Correct | 86 ms | 95204 KB | Output is correct |
23 | Correct | 88 ms | 95204 KB | Output is correct |
24 | Correct | 90 ms | 95204 KB | Output is correct |
25 | Correct | 88 ms | 95204 KB | Output is correct |
26 | Correct | 92 ms | 95204 KB | Output is correct |
27 | Correct | 85 ms | 95204 KB | Output is correct |
28 | Correct | 86 ms | 95204 KB | Output is correct |
29 | Correct | 88 ms | 95204 KB | Output is correct |
30 | Correct | 91 ms | 95204 KB | Output is correct |
31 | Correct | 97 ms | 95228 KB | Output is correct |
32 | Correct | 90 ms | 95228 KB | Output is correct |
33 | Correct | 89 ms | 95228 KB | Output is correct |
34 | Correct | 95 ms | 95228 KB | Output is correct |
35 | Correct | 93 ms | 95228 KB | Output is correct |
36 | Correct | 91 ms | 95228 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 87 ms | 95228 KB | Output is correct |
2 | Correct | 88 ms | 95228 KB | Output is correct |
3 | Correct | 89 ms | 95228 KB | Output is correct |
4 | Correct | 86 ms | 95228 KB | Output is correct |
5 | Correct | 88 ms | 95228 KB | Output is correct |
6 | Correct | 94 ms | 95228 KB | Output is correct |
7 | Correct | 86 ms | 95228 KB | Output is correct |
8 | Correct | 85 ms | 95228 KB | Output is correct |
9 | Correct | 92 ms | 95228 KB | Output is correct |
10 | Correct | 87 ms | 95228 KB | Output is correct |
11 | Correct | 89 ms | 95228 KB | Output is correct |
12 | Correct | 109 ms | 95228 KB | Output is correct |
13 | Correct | 86 ms | 95228 KB | Output is correct |
14 | Correct | 106 ms | 95228 KB | Output is correct |
15 | Correct | 88 ms | 95228 KB | Output is correct |
16 | Correct | 90 ms | 95228 KB | Output is correct |
17 | Correct | 92 ms | 95228 KB | Output is correct |
18 | Correct | 104 ms | 95264 KB | Output is correct |
19 | Correct | 107 ms | 95264 KB | Output is correct |
20 | Correct | 90 ms | 95264 KB | Output is correct |
21 | Correct | 92 ms | 95264 KB | Output is correct |
22 | Correct | 91 ms | 95264 KB | Output is correct |
23 | Correct | 93 ms | 95264 KB | Output is correct |
24 | Correct | 104 ms | 95356 KB | Output is correct |
25 | Correct | 103 ms | 95356 KB | Output is correct |
26 | Correct | 135 ms | 96124 KB | Output is correct |
27 | Correct | 182 ms | 96892 KB | Output is correct |
28 | Correct | 221 ms | 97660 KB | Output is correct |
29 | Correct | 183 ms | 97660 KB | Output is correct |
30 | Correct | 88 ms | 97660 KB | Output is correct |
31 | Correct | 242 ms | 97916 KB | Output is correct |
32 | Correct | 248 ms | 98128 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 89 ms | 98128 KB | Output is correct |
2 | Correct | 88 ms | 98128 KB | Output is correct |
3 | Correct | 86 ms | 98128 KB | Output is correct |
4 | Correct | 90 ms | 98128 KB | Output is correct |
5 | Correct | 86 ms | 98128 KB | Output is correct |
6 | Correct | 88 ms | 98128 KB | Output is correct |
7 | Correct | 86 ms | 98128 KB | Output is correct |
8 | Correct | 85 ms | 98128 KB | Output is correct |
9 | Correct | 85 ms | 98128 KB | Output is correct |
10 | Correct | 86 ms | 98128 KB | Output is correct |
11 | Correct | 87 ms | 98128 KB | Output is correct |
12 | Correct | 85 ms | 98128 KB | Output is correct |
13 | Correct | 85 ms | 98128 KB | Output is correct |
14 | Correct | 95 ms | 98128 KB | Output is correct |
15 | Correct | 98 ms | 98128 KB | Output is correct |
16 | Correct | 85 ms | 98128 KB | Output is correct |
17 | Correct | 87 ms | 98128 KB | Output is correct |
18 | Correct | 87 ms | 98128 KB | Output is correct |
19 | Correct | 89 ms | 98128 KB | Output is correct |
20 | Correct | 92 ms | 98128 KB | Output is correct |
21 | Correct | 91 ms | 98128 KB | Output is correct |
22 | Correct | 86 ms | 98128 KB | Output is correct |
23 | Correct | 91 ms | 98128 KB | Output is correct |
24 | Correct | 86 ms | 98128 KB | Output is correct |
25 | Correct | 85 ms | 98128 KB | Output is correct |
26 | Correct | 89 ms | 98128 KB | Output is correct |
27 | Correct | 91 ms | 98128 KB | Output is correct |
28 | Correct | 90 ms | 98128 KB | Output is correct |
29 | Correct | 92 ms | 98128 KB | Output is correct |
30 | Correct | 87 ms | 98128 KB | Output is correct |
31 | Correct | 91 ms | 98128 KB | Output is correct |
32 | Correct | 85 ms | 98128 KB | Output is correct |
33 | Correct | 87 ms | 98128 KB | Output is correct |
34 | Correct | 90 ms | 98128 KB | Output is correct |
35 | Correct | 87 ms | 98128 KB | Output is correct |
36 | Correct | 92 ms | 98128 KB | Output is correct |
37 | Correct | 86 ms | 98128 KB | Output is correct |
38 | Correct | 85 ms | 98128 KB | Output is correct |
39 | Correct | 86 ms | 98128 KB | Output is correct |
40 | Correct | 94 ms | 98128 KB | Output is correct |
41 | Correct | 99 ms | 98128 KB | Output is correct |
42 | Correct | 94 ms | 98128 KB | Output is correct |
43 | Correct | 89 ms | 98128 KB | Output is correct |
44 | Correct | 95 ms | 98128 KB | Output is correct |
45 | Correct | 95 ms | 98128 KB | Output is correct |
46 | Correct | 95 ms | 98128 KB | Output is correct |
47 | Correct | 99 ms | 98128 KB | Output is correct |
48 | Correct | 99 ms | 98128 KB | Output is correct |
49 | Correct | 138 ms | 98128 KB | Output is correct |
50 | Correct | 178 ms | 98128 KB | Output is correct |
51 | Correct | 225 ms | 98128 KB | Output is correct |
52 | Correct | 191 ms | 98128 KB | Output is correct |
53 | Correct | 89 ms | 98128 KB | Output is correct |
54 | Correct | 236 ms | 98128 KB | Output is correct |
55 | Correct | 252 ms | 98128 KB | Output is correct |
56 | Correct | 364 ms | 102268 KB | Output is correct |
57 | Execution timed out | 1082 ms | 113840 KB | Time limit exceeded |
58 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 113840 KB | Output is correct |
2 | Correct | 84 ms | 113840 KB | Output is correct |
3 | Correct | 88 ms | 113840 KB | Output is correct |
4 | Correct | 86 ms | 113840 KB | Output is correct |
5 | Correct | 86 ms | 113840 KB | Output is correct |
6 | Correct | 86 ms | 113840 KB | Output is correct |
7 | Correct | 88 ms | 113840 KB | Output is correct |
8 | Correct | 89 ms | 113840 KB | Output is correct |
9 | Correct | 84 ms | 113840 KB | Output is correct |
10 | Correct | 85 ms | 113840 KB | Output is correct |
11 | Correct | 89 ms | 113840 KB | Output is correct |
12 | Correct | 85 ms | 113840 KB | Output is correct |
13 | Correct | 86 ms | 113840 KB | Output is correct |
14 | Correct | 85 ms | 113840 KB | Output is correct |
15 | Correct | 88 ms | 113840 KB | Output is correct |
16 | Correct | 94 ms | 113840 KB | Output is correct |
17 | Correct | 84 ms | 113840 KB | Output is correct |
18 | Correct | 88 ms | 113840 KB | Output is correct |
19 | Correct | 86 ms | 113840 KB | Output is correct |
20 | Correct | 85 ms | 113840 KB | Output is correct |
21 | Correct | 86 ms | 113840 KB | Output is correct |
22 | Correct | 85 ms | 113840 KB | Output is correct |
23 | Correct | 109 ms | 113840 KB | Output is correct |
24 | Correct | 87 ms | 113840 KB | Output is correct |
25 | Correct | 92 ms | 113840 KB | Output is correct |
26 | Correct | 89 ms | 113840 KB | Output is correct |
27 | Correct | 88 ms | 113840 KB | Output is correct |
28 | Correct | 94 ms | 113840 KB | Output is correct |
29 | Correct | 91 ms | 113840 KB | Output is correct |
30 | Correct | 85 ms | 113840 KB | Output is correct |
31 | Correct | 94 ms | 113840 KB | Output is correct |
32 | Correct | 96 ms | 113840 KB | Output is correct |
33 | Correct | 89 ms | 113840 KB | Output is correct |
34 | Correct | 95 ms | 113840 KB | Output is correct |
35 | Correct | 99 ms | 113840 KB | Output is correct |
36 | Correct | 136 ms | 113840 KB | Output is correct |
37 | Correct | 180 ms | 113840 KB | Output is correct |
38 | Correct | 221 ms | 113840 KB | Output is correct |
39 | Correct | 186 ms | 113840 KB | Output is correct |
40 | Correct | 89 ms | 113840 KB | Output is correct |
41 | Correct | 235 ms | 113840 KB | Output is correct |
42 | Correct | 247 ms | 113840 KB | Output is correct |
43 | Correct | 363 ms | 113840 KB | Output is correct |
44 | Execution timed out | 1082 ms | 114032 KB | Time limit exceeded |
45 | Halted | 0 ms | 0 KB | - |