using System.Collections; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; internal class Program { private const long mod = 998244353; private const long mod17 = 1000000007; private const long INF = mod17 * mod17; public static void Main(string[] args) { var line = getar(); int n = line[0], m = line[1], k = line[2]; var c = getar(); for (int i = 0; i < n; i++) c[i]--; var a = getar(); long ans = INF; for (int i = 0; i < m; i++) { long val = (long)a[i] * k; ans = Math.Min(ans, val); } List> ids = new List>(m); for(int i=0;i()); for (int i = 0; i < n; i++) { ids[c[i]].Add(i); } for (int i = 0; i < m; i++) { if (ids[i].Count() == 0) continue; int r = 0; for (int l = 0; l < ids[i].Count(); l++) { while (r + 1 < ids[i].Count() && ids[i][r + 1] - ids[i][l] < k) r++; int num = r - l + 1; long val = (long)(k - num) * a[i]; ans = Math.Min(ans, val); } } Console.WriteLine(ans); } public class lower_bound : IComparer where T : IComparable { public int Compare(T x, T y) { return 0 <= x.CompareTo(y) ? 1 : -1; } } public static List mkar(int n, T val) { List res = new List(n); for(int i=0;i