# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1050362 | 2024-08-09T08:56:14 Z | manhlinh1501 | Bali Sculptures (APIO15_sculpture) | C++17 | 4 ms | 31876 KB |
#include <bits/stdc++.h> using namespace std; using i64 = long long; const int MAXN = 2e3 + 5; const i64 oo64 = 2e18; int N, L, R; int a[MAXN]; i64 dp[MAXN][MAXN]; i64 prefix[MAXN]; signed main() { #define TASK "code" if (fopen(TASK ".inp", "r")) { freopen(TASK ".inp", "r", stdin); freopen(TASK ".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> L >> R; memset(dp, 0x3f, sizeof dp); dp[0][0] = 0; for(int i = 1; i <= N; i++) cin >> a[i]; for(int i = 1; i <= N; i++) prefix[i] = prefix[i - 1] + a[i]; for(int i = 1; i <= N; i++) { for(int j = 1; j <= i; j++) { for(int z = 1; z <= R; z++) { if(dp[j - 1][z - 1] >= oo64) continue; dp[i][z] = min(dp[i][z], (dp[j - 1][z - 1] | (prefix[i] - prefix[j - 1]))); } } } i64 ans = oo64; for(int i = L; i <= R; i++) ans = min(ans, dp[N][i]); cout << ans; return (0 ^ 0); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 31836 KB | Output is correct |
2 | Incorrect | 3 ms | 31700 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 31704 KB | Output is correct |
2 | Incorrect | 3 ms | 31836 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 31876 KB | Output is correct |
2 | Incorrect | 3 ms | 31836 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 31696 KB | Output is correct |
2 | Incorrect | 3 ms | 31836 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 31836 KB | Output is correct |
2 | Incorrect | 3 ms | 31836 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |