Submission #127064

#TimeUsernameProblemLanguageResultExecution timeMemory
127064Harry464Sličice (COCI19_slicice)C++14
90 / 90
148 ms504 KiB
#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 timeMemoryGrader output
Fetching results...