시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB30161560.000%

문제

You are Nilan, teaching a class of n students. Recently, each student sat for two examinations — Physics and Biology. The scores of the i-th student in Physics and Biology are denoted by A[i] and B[i] respectively. Each score is a non-negative integer not exceeding 10000, i.e. 0 ≤ A[i], B[i] ≤ 10000, ∀i ∈ [1, n].

Based on their results, you are to select a and b students to participate in the Physics and Biology categories of a Science competition respectively. To give all students a chance to represent their school, each student must be enrolled in exactly one of the categories.

Naturally, the school wants to maximise its chances of winning by sending the strongest team possible. This is achieved when the sum of Physics scores of the a Physics students combined with the sum of Biology scores of the b Biology students is maximised.

As their teacher, determine the maximum possible combined score of the Physics and Biology teams!

입력

Your program must read from standard input.

The first line of the input contains 3 integers n, a and b denoting the total number of students, the size of the Physics team and the size of the Biology team. It is guaranteed that a + b = n i.e. all students take part as either a Physics or a Biology competitor.

2 lines will follow. The first line contains n integers, i.e A[1], A[2], . . . , A[n]. The second line contains n integers, i.e B[1], B[2], . . . , B[n].

출력

Your program must print to standard output.

The output should contain a single integer on a single line, the maximum combined sum of all the Physics scores of the Physics team, and the Biology scores of the Biology team.

제한

  • 1 ≤ n ≤ 105
  • 0 ≤ a, b ≤ n
  • a + b = n
  • 0 ≤ A[i], B[i] ≤ 10000, ∀i ∈ [1, n]

서브태스크

번호배점제한
129

1 ≤ n ≤ 20

222

B[i] = 0, ∀i ∈ [1, n]

349

예제 입력 1

3 1 2
5 3 4
7 1 4

예제 출력 1

14

The optimal way of choosing the school team is to assign the second student to the Physics team and the first and third students to the Biology team. The combined Physics score of the Physics team is 3, while the combined Biology score of the Biology team is 7 + 4 = 11. The total score is thus 3 + 11 = 14. It is impossible to achieve a total score higher than 14, thus 14 is our answer.

예제 입력 2

5 3 2
5 6 6 5 1
0 0 0 0 0

예제 출력 2

17

The optimal way of choosing the school team is to assign the first three students to the Physics team and the last two students to the Biology team. The combined Physics score of the Physics team is 5 + 6 + 6 = 17, while the combined Biology score of the Biology team is 0 + 0 = 0. The total score is thus 17 + 0 = 17. It is impossible to achieve a total score higher than 17, thus 17 is our answer.

채점 및 기타 정보

  • 예제는 채점하지 않는다.