P28127 [洛谷] [NOISG2021 Qualification] Competition
普及
题目描述

Problem Description

You are a teacher with $n$ students, each having a physics score $A_i$ and a biology score $B_i$. You need to select $a$ students to participate in the physics competition and $b$ students to participate in the biology competition. Each student must participate in exactly one competition.

The strength value of your school is defined as the sum of the physics scores of the students participating in the physics competition and the biology scores of the students participating in the biology competition. Please determine the maximum strength value.

Input Format

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

The second line contains $n$ integers $A_i$.

The third line contains $n$ integers $B_i$.

Output Format

A single line containing one integer, the maximum strength value.

Sample Input and Output

Sample Input #1

3 1 2
5 3 4
7 1 4

Sample Output #1

14

Sample Input #2

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

Sample Output #2

17

Notes

Sample 1 Explanation

The first and third students participate in the biology competition, and the second student participates in the physics competition.

Data Range

This problem uses bundled testing.

Subtask0 is the sample.

Subtask1 (29 pts): $n \leq 20$.

Subtask2 (22 pts): All $B_i$ are guaranteed to be 0.

Subtask3 (49 pts): No special restrictions.

The data guarantees $1 \leq n \leq 10^5$, $0 \leq a, b \leq n$, $a + b = n$, $0 \leq A_i, B_i \leq 10^4$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 2 5 3 4 7 1 4
样例输出
14