CF799E.Aquarium decoration

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Arkady and Masha want to choose decorations for thier aquarium in Fishdom game. They have nn decorations to choose from, each of them has some cost. To complete a task Arkady and Masha need to choose exactly mm decorations from given, and they want to spend as little money as possible.

There is one difficulty: Masha likes some aa of the given decorations, Arkady likes some bb of the given decorations. Some decorations may be liked by both Arkady and Masha, or not be liked by both. The friends want to choose such decorations so that each of them likes at least kk decorations among the chosen. Help Masha and Arkady find the minimum sum of money they need to spend.

输入格式

The first line contains three integers nn , mm and kk ( 1<=n<=2000001<=n<=200000 , 1<=m<=n1<=m<=n , 1<=k<=n1<=k<=n ) — the number of decorations, how many decorations the friends should choose, how many decorations each of them should like among the chosen.

The second line contains nn integers c1,c2,...,cnc_{1},c_{2},...,c_{n} ( 1<=ci<=1091<=c_{i}<=10^{9} ) — decorations costs.

The third line contains single integer aa ( 1<=a<=n1<=a<=n ) — the number of decorations liked by Masha. The fourth line contains aa distinct integers x1,x2,...,xax_{1},x_{2},...,x_{a} ( 1<=xi<=n1<=x_{i}<=n ) — the ids of decorations liked by Masha.

The next two lines describe decorations liked by Arkady in the same format.

输出格式

Print single integer: the minimum sum of money the friends should spend to fulfill all constraints. If it is not possible, print -1.

输入输出样例

  • 输入#1

    4 3 2
    3 2 2 1
    2
    1 2
    2
    1 3
    

    输出#1

    7
    
  • 输入#2

    4 3 2
    3 2 2 1
    2
    1 2
    3
    4 1 3
    

    输出#2

    6
    
  • 输入#3

    4 2 2
    3 2 2 1
    2
    1 2
    3
    4 1 3
    

    输出#3

    -1
    

说明/提示

In the first example the only possible variant to choose 33 decorations having all conditions satisfied is to choose decorations 11 , 22 , 33 .

In the second example friends can choose decoration 44 instead of decoration 33 , because this one is one coin cheaper.

In the third example it's not possible to choose 22 decorations in a way that both are liked by both Masha and Arkady.

首页