#P10771. [NOISG 2021 Qualification] Competition

[NOISG 2021 Qualification] Competition

Problem Description

You are a teacher with nn students. Each student has a Physics score AiA_i and a Biology score BiB_i. You need to choose aa students to participate in the Physics competition and bb students to participate in the Biology competition. Each student must participate in exactly one competition.

Define your school's strength value as the sum of the Physics scores of those who participate in the Physics competition and the Biology scores of those who participate in the Biology competition. Find the maximum possible strength value.

Input Format

The first line contains three integers n,a,bn, a, b.

The second line contains nn integers AiA_i.

The third line contains nn integers BiB_i.

Output Format

Output one integer in one line: the maximum strength value.

3 1 2
5 3 4
7 1 4
14
5 3 2
5 6 6 5 1
0 0 0 0 0
17

Hint

Explanation for Sample 1

The 1st and 3rd students participate in the Biology competition, and the 2nd student participates in the Physics competition.

Constraints

This problem uses bundled testdata.

Subtask0 is the sample.

Subtask1 (29 pts): n20n \leq 20.

Subtask2 (22 pts): it is guaranteed that all Bi=0B_i=0.

Subtask3 (49 pts): no special constraints.

It is guaranteed that 1n1051 \leq n \leq 10^5, 0a,bn0 \leq a,b \leq n, a+b=na+b=n, and 0Ai,Bi1040 \leq A_i,B_i \leq 10^4.

Translated by ChatGPT 5