# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127896 | 2019-07-10T08:15:46 Z | zoooma13 | Bali Sculptures (APIO15_sculpture) | C++14 | 2 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; #define MAX_N 102 int n ,a ,b; int y[MAX_N]; long long sum[MAX_N]; int main() { scanf("%d%d%d",&n,&a,&b); assert(n < MAX_N); for(int i=1; i<=n; i++) scanf("%d",&y[i]) ,sum[i] = sum[i-1]+y[i]; vector <long long> dp(n+1) ,curr_dp(n+1); long long ans = (a == 1 ? sum[n] : 1e18); for(int i=1; i<=n; i++) curr_dp[i] = curr_dp[i-1]+y[i]; for(int k=2; k<=b; k++){ swap(dp ,curr_dp); for(int i=k; i<=n; i++){ curr_dp[i] = 1e18; for(int j=k; j<=i; j++) curr_dp[i] = min(curr_dp[i] ,(sum[i]-sum[j-1])|dp[j-1]); } //cout << k << " : " << curr_dp[n] << endl; if(a <= k) ans = min(ans ,curr_dp[n]); } printf("%d\n",ans); } /** 6 1 3 8 1 2 1 5 4 5 5 5 1 2 3 4 5 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |