# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127064 | Harry464 | Sličice (COCI19_slicice) | C++14 | 148 ms | 504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m, k;
cin >> n >> m >> k;
vector <int> p(n);
for (int i = 0; i < n; i++) cin >> p[i];
vector <int> b(m+1);
for (int i = 0; i <= m; i++) cin >> b[i];
vector <int> dp(k+1,0);
for (int i = 0; i < n; i++){
vector <int> dp2(k+1,0);
for (int j = 0; j <= k; j++){
for (int s = 0; s <= j; s++){
int dod = j - s;
if (p[i] + dod > m) continue;
dp2[j] = max(dp2[j], dp[s] + b[p[i] + dod]);
}
}
dp = dp2;
}
cout << dp[k];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |