文理学院程序设计在线练习


Mathematics homework

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 19   Accepted Submission(s): 5
Problem Description

In the new term, new mathematics class has began and makes Lily puzzled.
There are N days totally in the term and M mathematics lessons which will arrange the homework after class. And there are K days Lily need to submit homework. Before submitting homework, Lily should finish all previous problems and then submit . And handing in homework always in the morning so that students have no time to do previous homework in that day . But taking the lesson is also in the morning so Lily can finish his homework that day. Everyday Lily can just do one day’s homework because it’s too hard.
Lily will get happiness point everyday if she doesn’t do any homework , for the ith day is Ci (i=1,2,3,...).
Please write a program and output the maximum sum of happiness point Lily can get in this term.

Input

The first line is an integer, T, representing the T cases.
Each case's first line is N,M,K, representing the number of days in the term, the number of mathematics lessons and the times of submit homework .
The second row of each case contains N numbers C1, C2, C3,... CN, representing the happiness point Lily can get in day i.
The third row of each case contains M numbers A1, A2, A3,... AM, representing the days which will have a mathematics lesson and teacher will arrange the homework.
The fourth row of each case contains K numbers B1, B2, B3,... BK, representing the days lily should submit her homework.

Limit:
1 <= T <= 105
1 <= N <= 365
1 <= ai ,bi,M,K <= N
1 <= ci <= 5000

Output

Output one line for each case: 'Case #x: y'. Representing case x's answer is y.

Sample Input
2
7 2 1
1 5 2 3 4 6 7
2 4
7
3 2 2
4 3 2
1 2 
2 3
Sample Output
Case #1: 23
Case #2: 2
Source

2018绍兴市联赛