# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
883612 | 2023-12-05T13:58:38 Z | vjudge1 | K blocks (IZhO14_blocks) | C++17 | 159 ms | 262144 KB |
#include <bits/stdc++.h> using namespace std; long long a[1000005]; long long solve (long long l, long long r, long long k) { if (k==1) return min(a[l], a[r]); return min(solve(l+1, r, k-1)+a[l], solve(l, r-1, k-1)); } int main() { long long t, n, k; cin >> n >> k; long long ans = 0, mx = 0; for (long long i = 0; i < n; i++) cin >> a[i]; for (long long i = 0; i < n; i++) mx = max(mx, a[i]); long long l = 0, r = n-1; cout << solve(l, r, k-1)+mx << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 159 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 156 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 159 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 159 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |