https://codeforces.com/contest/1625/problem/C
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e3 + 10;
int n, L, k;
int a[N], b[N];
void solve() {
cin >> n >> L >> k;
for (int i =1; i <= n; i++)
cin >> a[i - 1];
a[n] = L;
for (int j =1; j <= n; j++)
cin >> b[j - 1];
int dp[N][N];
memset (dp, 0x3f, sizeof dp);
dp[0][0] = 0;
for (int i = 0; i <= k; i ++) {
for (int j = 0; j <= n; j ++) {
for (int j2 = j + 1; j2 <= n; j2 ++) {
int i2 = i + (j2 - j - 1);
if (i2 <= k)
dp[i2][j2] = min (dp[i2][j2], dp[i][j] + (a[j2] - a[j]) * b[j]);
}
}
}
int ans = 0x3f3f3f3f;
for (int i = 0; i <= k; i++)
ans = min (ans, dp[i][n]);
cout << ans << endl;
}
signed main () {
int t;
t = 1;
while(t --) solve();
}
dp[i][j]表示前j个并且已经消除i个点的最小值