| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 942495 | artixkrishna | Sličice (COCI19_slicice) | C++14 | 0 ms | 0 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 <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
int dp[506][506];
template <class X, class Y> bool maximize(X &x, const Y &y) {
  X eps = 1e-9;
  if (x + eps < y) {
    x = y;
    return 1;
  }
  return 0;
}
template <class X, class Y> bool minimize(X &x, const Y &y) {
  X eps = 1e-9;
  if (x > y + eps) {
    x = y;
    return 1;
  }
  return 0;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> P(n);
  vector<int> B(m + 1);
  for (auto &i : P)
    cin >> i;
  for (auto &i : B)
    cin >> i;
  for (int i = 1; i <= n; i++) {
    for (int v = 0; v <= k; v++) {
      for (int pre_v = 0; pre_v <= v; pre_v++) {
        maximize(dp[i][v], dp[i - 1][pre_v] + b[a[i] + (v - pre_v)]);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    maximize(ans, dp[n][i]);
  }
  cout << ans << endl;
}
