# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
455102 | 2021-08-05T12:33:21 Z | qwerasdfzxcl | Bali Sculptures (APIO15_sculpture) | C++14 | 1 ms | 332 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int a[2020]; ll dp[2020][2020]; int main(){ int n, l, r; scanf("%d %d %d", &n, &l, &r); for (int i=1;i<=n;i++) scanf("%d", a+i); for (int i=1;i<=n;i++){ dp[i][1] = dp[i-1][1]+a[i]; for (int j=2;j<=i;j++){ dp[i][j] = 1e18; ll cur = 0; for (int k=i;k>j-1;k--){ cur += a[k]; dp[i][j] = min(dp[i][j], dp[k-1][j-1]|cur); } } /*for (int j=1;j<=i;j++) printf("%lld ", dp[i][j]); printf("\n");*/ } ll ans = 1e18; for (int i=l;i<=r;i++) ans = min(ans, dp[n][i]); printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 0 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |