CF990E.Post Lamps
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has n positions to install lamps, they correspond to the integer numbers from 0 to n−1 on the OX axis. However, some positions are blocked and no post lamp can be placed there.
There are post lamps of different types which differ only by their power. When placed in position x , post lamp of power l illuminates the segment [x;x+l] . The power of each post lamp is always a positive integer number.
The post lamp shop provides an infinite amount of lamps of each type from power 1 to power k . Though each customer is only allowed to order post lamps of exactly one type. Post lamps of power l cost al each.
What is the minimal total cost of the post lamps of exactly one type Adilbek can buy to illuminate the entire segment [0;n] of the street? If some lamps illuminate any other segment of the street, Adilbek does not care, so, for example, he may place a lamp of power 3 in position n−1 (even though its illumination zone doesn't completely belong to segment [0;n] ).
输入格式
The first line contains three integer numbers n , m and k ( 1≤k≤n≤106 , 0≤m≤n ) — the length of the segment of the street Adilbek wants to illuminate, the number of the blocked positions and the maximum power of the post lamp available.
The second line contains m integer numbers s1,s2,…,sm ( 0≤s1<s2<…sm<n ) — the blocked positions.
The third line contains k integer numbers a1,a2,…,ak ( 1≤ai≤106 ) — the costs of the post lamps.
输出格式
Print the minimal total cost of the post lamps of exactly one type Adilbek can buy to illuminate the entire segment [0;n] of the street.
If illumintaing the entire segment [0;n] is impossible, print -1.
输入输出样例
输入#1
6 2 3 1 3 1 2 3
输出#1
6
输入#2
4 3 4 1 2 3 1 10 100 1000
输出#2
1000
输入#3
5 1 5 0 3 3 3 3 3
输出#3
-1
输入#4
7 4 3 2 4 5 6 3 14 15
输出#4
-1