# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49912 | 2018-06-04T20:59:24 Z | kjain_1810 | Bali Sculptures (APIO15_sculpture) | C++17 | 3 ms | 740 KB |
#include<bits/stdc++.h> using namespace std; const int N=1e2+5; long long arr[N], dp[N][N], n, m, A, B, pref[N]; //dp[i][j]==dividing first i numbers in j parts int main() { #define int long long scanf("%lld%lld%lld", &n, &A, &B); for(int a=1; a<=n; a++) scanf("%d", &arr[a]); for(int a=1; a<=n; a++) pref[a]=pref[a-1]+arr[a]; for(int a=1; a<=n; a++) dp[a][1]=pref[a]; int ans=1e18; if(A==1) ans=dp[n][1]; for(int a=2; a<=B; a++) { for(int b=a; b<=n; b++) { dp[b][a]=1e18; for(int c=b-1; c>=1; c--) dp[b][a]=min(dp[b][a], dp[c][a-1]|(pref[b]-pref[c])); } if(a>=A) ans=min(ans, dp[n][a]); } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Incorrect | 2 ms | 356 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 392 KB | Output is correct |
2 | Incorrect | 2 ms | 468 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 468 KB | Output is correct |
2 | Incorrect | 2 ms | 672 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 672 KB | Output is correct |
2 | Incorrect | 2 ms | 736 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 740 KB | Output is correct |
2 | Incorrect | 2 ms | 740 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |