# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
74282 | 2018-08-30T19:52:04 Z | Vardanyan | Bali Sculptures (APIO15_sculpture) | C++14 | 1000 ms | 113068 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 79 ms | 94712 KB | Output is correct |
2 | Correct | 77 ms | 94908 KB | Output is correct |
3 | Correct | 78 ms | 94908 KB | Output is correct |
4 | Correct | 77 ms | 94908 KB | Output is correct |
5 | Correct | 79 ms | 94932 KB | Output is correct |
6 | Correct | 78 ms | 95008 KB | Output is correct |
7 | Correct | 78 ms | 95008 KB | Output is correct |
8 | Correct | 79 ms | 95008 KB | Output is correct |
9 | Correct | 80 ms | 95008 KB | Output is correct |
10 | Correct | 78 ms | 95068 KB | Output is correct |
11 | Correct | 80 ms | 95068 KB | Output is correct |
12 | Correct | 78 ms | 95068 KB | Output is correct |
13 | Correct | 78 ms | 95068 KB | Output is correct |
14 | Correct | 79 ms | 95068 KB | Output is correct |
15 | Correct | 77 ms | 95068 KB | Output is correct |
16 | Correct | 80 ms | 95084 KB | Output is correct |
17 | Correct | 78 ms | 95084 KB | Output is correct |
18 | Correct | 81 ms | 95084 KB | Output is correct |
19 | Correct | 82 ms | 95084 KB | Output is correct |
20 | Correct | 78 ms | 95084 KB | Output is correct |
21 | Correct | 80 ms | 95084 KB | Output is correct |
22 | Correct | 80 ms | 95084 KB | Output is correct |
23 | Correct | 78 ms | 95084 KB | Output is correct |
24 | Correct | 78 ms | 95084 KB | Output is correct |
25 | Correct | 77 ms | 95084 KB | Output is correct |
26 | Correct | 78 ms | 95084 KB | Output is correct |
27 | Correct | 78 ms | 95084 KB | Output is correct |
28 | Correct | 79 ms | 95084 KB | Output is correct |
29 | Correct | 79 ms | 95084 KB | Output is correct |
30 | Correct | 79 ms | 95084 KB | Output is correct |
31 | Correct | 78 ms | 95084 KB | Output is correct |
32 | Correct | 77 ms | 95084 KB | Output is correct |
33 | Correct | 79 ms | 95084 KB | Output is correct |
34 | Correct | 77 ms | 95084 KB | Output is correct |
35 | Correct | 81 ms | 95084 KB | Output is correct |
36 | Correct | 83 ms | 95084 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 83 ms | 95084 KB | Output is correct |
2 | Correct | 77 ms | 95084 KB | Output is correct |
3 | Correct | 78 ms | 95084 KB | Output is correct |
4 | Correct | 80 ms | 95084 KB | Output is correct |
5 | Correct | 81 ms | 95084 KB | Output is correct |
6 | Correct | 80 ms | 95084 KB | Output is correct |
7 | Correct | 79 ms | 95084 KB | Output is correct |
8 | Correct | 79 ms | 95084 KB | Output is correct |
9 | Correct | 82 ms | 95084 KB | Output is correct |
10 | Correct | 78 ms | 95084 KB | Output is correct |
11 | Correct | 80 ms | 95084 KB | Output is correct |
12 | Correct | 79 ms | 95084 KB | Output is correct |
13 | Correct | 79 ms | 95084 KB | Output is correct |
14 | Correct | 78 ms | 95084 KB | Output is correct |
15 | Correct | 78 ms | 95100 KB | Output is correct |
16 | Correct | 77 ms | 95100 KB | Output is correct |
17 | Correct | 77 ms | 95100 KB | Output is correct |
18 | Correct | 80 ms | 95100 KB | Output is correct |
19 | Correct | 78 ms | 95100 KB | Output is correct |
20 | Correct | 78 ms | 95100 KB | Output is correct |
21 | Correct | 78 ms | 95100 KB | Output is correct |
22 | Correct | 80 ms | 95100 KB | Output is correct |
23 | Correct | 79 ms | 95100 KB | Output is correct |
24 | Correct | 79 ms | 95100 KB | Output is correct |
25 | Correct | 79 ms | 95100 KB | Output is correct |
26 | Correct | 78 ms | 95100 KB | Output is correct |
27 | Correct | 80 ms | 95100 KB | Output is correct |
28 | Correct | 78 ms | 95100 KB | Output is correct |
29 | Correct | 83 ms | 95100 KB | Output is correct |
30 | Correct | 81 ms | 95100 KB | Output is correct |
31 | Correct | 90 ms | 95420 KB | Output is correct |
32 | Correct | 83 ms | 95420 KB | Output is correct |
33 | Correct | 78 ms | 95420 KB | Output is correct |
34 | Correct | 87 ms | 95420 KB | Output is correct |
35 | Correct | 86 ms | 95420 KB | Output is correct |
36 | Correct | 84 ms | 95420 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 79 ms | 95420 KB | Output is correct |
2 | Correct | 78 ms | 95420 KB | Output is correct |
3 | Correct | 79 ms | 95420 KB | Output is correct |
4 | Correct | 80 ms | 95420 KB | Output is correct |
5 | Correct | 81 ms | 95420 KB | Output is correct |
6 | Correct | 79 ms | 95420 KB | Output is correct |
7 | Correct | 81 ms | 95420 KB | Output is correct |
8 | Correct | 78 ms | 95420 KB | Output is correct |
9 | Correct | 83 ms | 95420 KB | Output is correct |
10 | Correct | 78 ms | 95420 KB | Output is correct |
11 | Correct | 78 ms | 95420 KB | Output is correct |
12 | Correct | 84 ms | 95420 KB | Output is correct |
13 | Correct | 82 ms | 95420 KB | Output is correct |
14 | Correct | 82 ms | 95420 KB | Output is correct |
15 | Correct | 83 ms | 95420 KB | Output is correct |
16 | Correct | 79 ms | 95420 KB | Output is correct |
17 | Correct | 87 ms | 95420 KB | Output is correct |
18 | Correct | 90 ms | 95420 KB | Output is correct |
19 | Correct | 84 ms | 95420 KB | Output is correct |
20 | Correct | 81 ms | 95420 KB | Output is correct |
21 | Correct | 89 ms | 95420 KB | Output is correct |
22 | Correct | 85 ms | 95420 KB | Output is correct |
23 | Correct | 90 ms | 95420 KB | Output is correct |
24 | Correct | 94 ms | 95420 KB | Output is correct |
25 | Correct | 98 ms | 95420 KB | Output is correct |
26 | Correct | 137 ms | 96124 KB | Output is correct |
27 | Correct | 185 ms | 96892 KB | Output is correct |
28 | Correct | 259 ms | 97660 KB | Output is correct |
29 | Correct | 181 ms | 97660 KB | Output is correct |
30 | Correct | 78 ms | 97660 KB | Output is correct |
31 | Correct | 253 ms | 97916 KB | Output is correct |
32 | Correct | 261 ms | 98044 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 79 ms | 98044 KB | Output is correct |
2 | Correct | 81 ms | 98044 KB | Output is correct |
3 | Correct | 81 ms | 98044 KB | Output is correct |
4 | Correct | 78 ms | 98044 KB | Output is correct |
5 | Correct | 82 ms | 98044 KB | Output is correct |
6 | Correct | 78 ms | 98044 KB | Output is correct |
7 | Correct | 81 ms | 98044 KB | Output is correct |
8 | Correct | 80 ms | 98044 KB | Output is correct |
9 | Correct | 79 ms | 98044 KB | Output is correct |
10 | Correct | 79 ms | 98044 KB | Output is correct |
11 | Correct | 79 ms | 98044 KB | Output is correct |
12 | Correct | 80 ms | 98044 KB | Output is correct |
13 | Correct | 80 ms | 98044 KB | Output is correct |
14 | Correct | 78 ms | 98044 KB | Output is correct |
15 | Correct | 84 ms | 98044 KB | Output is correct |
16 | Correct | 78 ms | 98044 KB | Output is correct |
17 | Correct | 78 ms | 98044 KB | Output is correct |
18 | Correct | 82 ms | 98044 KB | Output is correct |
19 | Correct | 79 ms | 98044 KB | Output is correct |
20 | Correct | 81 ms | 98044 KB | Output is correct |
21 | Correct | 79 ms | 98044 KB | Output is correct |
22 | Correct | 78 ms | 98044 KB | Output is correct |
23 | Correct | 79 ms | 98044 KB | Output is correct |
24 | Correct | 79 ms | 98044 KB | Output is correct |
25 | Correct | 78 ms | 98044 KB | Output is correct |
26 | Correct | 86 ms | 98044 KB | Output is correct |
27 | Correct | 87 ms | 98044 KB | Output is correct |
28 | Correct | 79 ms | 98044 KB | Output is correct |
29 | Correct | 79 ms | 98044 KB | Output is correct |
30 | Correct | 79 ms | 98044 KB | Output is correct |
31 | Correct | 89 ms | 98044 KB | Output is correct |
32 | Correct | 79 ms | 98044 KB | Output is correct |
33 | Correct | 103 ms | 98044 KB | Output is correct |
34 | Correct | 81 ms | 98044 KB | Output is correct |
35 | Correct | 80 ms | 98044 KB | Output is correct |
36 | Correct | 79 ms | 98044 KB | Output is correct |
37 | Correct | 83 ms | 98044 KB | Output is correct |
38 | Correct | 83 ms | 98044 KB | Output is correct |
39 | Correct | 80 ms | 98044 KB | Output is correct |
40 | Correct | 84 ms | 98044 KB | Output is correct |
41 | Correct | 92 ms | 98044 KB | Output is correct |
42 | Correct | 85 ms | 98044 KB | Output is correct |
43 | Correct | 78 ms | 98044 KB | Output is correct |
44 | Correct | 85 ms | 98044 KB | Output is correct |
45 | Correct | 87 ms | 98044 KB | Output is correct |
46 | Correct | 84 ms | 98044 KB | Output is correct |
47 | Correct | 91 ms | 98044 KB | Output is correct |
48 | Correct | 95 ms | 98044 KB | Output is correct |
49 | Correct | 135 ms | 98044 KB | Output is correct |
50 | Correct | 185 ms | 98044 KB | Output is correct |
51 | Correct | 239 ms | 98044 KB | Output is correct |
52 | Correct | 184 ms | 98044 KB | Output is correct |
53 | Correct | 83 ms | 98044 KB | Output is correct |
54 | Correct | 247 ms | 98044 KB | Output is correct |
55 | Correct | 261 ms | 98044 KB | Output is correct |
56 | Correct | 379 ms | 102180 KB | Output is correct |
57 | Execution timed out | 1084 ms | 113068 KB | Time limit exceeded |
58 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 85 ms | 113068 KB | Output is correct |
2 | Correct | 79 ms | 113068 KB | Output is correct |
3 | Correct | 83 ms | 113068 KB | Output is correct |
4 | Correct | 81 ms | 113068 KB | Output is correct |
5 | Correct | 88 ms | 113068 KB | Output is correct |
6 | Correct | 79 ms | 113068 KB | Output is correct |
7 | Correct | 81 ms | 113068 KB | Output is correct |
8 | Correct | 79 ms | 113068 KB | Output is correct |
9 | Correct | 80 ms | 113068 KB | Output is correct |
10 | Correct | 77 ms | 113068 KB | Output is correct |
11 | Correct | 79 ms | 113068 KB | Output is correct |
12 | Correct | 80 ms | 113068 KB | Output is correct |
13 | Correct | 81 ms | 113068 KB | Output is correct |
14 | Correct | 80 ms | 113068 KB | Output is correct |
15 | Correct | 79 ms | 113068 KB | Output is correct |
16 | Correct | 80 ms | 113068 KB | Output is correct |
17 | Correct | 79 ms | 113068 KB | Output is correct |
18 | Correct | 82 ms | 113068 KB | Output is correct |
19 | Correct | 83 ms | 113068 KB | Output is correct |
20 | Correct | 82 ms | 113068 KB | Output is correct |
21 | Correct | 79 ms | 113068 KB | Output is correct |
22 | Correct | 79 ms | 113068 KB | Output is correct |
23 | Correct | 79 ms | 113068 KB | Output is correct |
24 | Correct | 78 ms | 113068 KB | Output is correct |
25 | Correct | 79 ms | 113068 KB | Output is correct |
26 | Correct | 84 ms | 113068 KB | Output is correct |
27 | Correct | 86 ms | 113068 KB | Output is correct |
28 | Correct | 91 ms | 113068 KB | Output is correct |
29 | Correct | 85 ms | 113068 KB | Output is correct |
30 | Correct | 80 ms | 113068 KB | Output is correct |
31 | Correct | 87 ms | 113068 KB | Output is correct |
32 | Correct | 85 ms | 113068 KB | Output is correct |
33 | Correct | 85 ms | 113068 KB | Output is correct |
34 | Correct | 91 ms | 113068 KB | Output is correct |
35 | Correct | 98 ms | 113068 KB | Output is correct |
36 | Correct | 137 ms | 113068 KB | Output is correct |
37 | Correct | 184 ms | 113068 KB | Output is correct |
38 | Correct | 232 ms | 113068 KB | Output is correct |
39 | Correct | 190 ms | 113068 KB | Output is correct |
40 | Correct | 79 ms | 113068 KB | Output is correct |
41 | Correct | 248 ms | 113068 KB | Output is correct |
42 | Correct | 263 ms | 113068 KB | Output is correct |
43 | Correct | 389 ms | 113068 KB | Output is correct |
44 | Execution timed out | 1089 ms | 113068 KB | Time limit exceeded |
45 | Halted | 0 ms | 0 KB | - |