## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## Three Arrays CodeChef Solution | CodeChef Problem Solution 2022

You are given three arrays $A$$B$, and $C$, all of length $N$. You also have two integers ${k}_{1}$ and ${k}_{2}$.

For every index $1\le i\le N$, you must choose exactly one of ${A}_{i},{B}_{i}$, or ${C}_{i}$. Find the maximum possible sum of chosen elements, such that:

• At most ${k}_{1}$ elements are picked from $A$, and
• At most ${k}_{2}$ elements are picked from $B$

### Input Format

• The first line of input contains an integer $T$, denoting the number of test cases. $T$ test cases follow.
• Each test case consists of five lines of input.
Solution Click Below:-

• The first line of each test case contains the integer $N$ — the length of the arrays.
• The second line contains $N$ space-separated integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$.
• The third line contains $N$ space-separated integers ${B}_{1},{B}_{2},\dots ,{B}_{N}$.
• The fourth line contains $N$ space-separated integers ${C}_{1},{C}_{2},\dots ,{C}_{N}$.
• The fifth line contains two space-separated integers ${k}_{1}$ and ${k}_{2}$.

### Output Format

For each test case, output on a new line the maximum sum possible by selecting the elements under the specified constraints.

### Constraints

• $1\le T\le {10}^{5}$
• $1\le N\le 5\cdot {10}^{5}$
• $1\le {A}_{i},{B}_{i},{C}_{i}\le {10}^{9}$
• $0\le {k}_{1},{k}_{2}\le N$
• It is guaranteed that the sum of $N$ across all test cases doesn't exceed $5\cdot {10}^{5}$.
Who is taller! CodeChef Solution | CodeChef Problem Solution 2022Chef and Chapters CodeChef Solution | CodeChef Problem Solution 2022Presents for Cheffina CodeChef Solution | CodeChef Problem Solution 2022Chef and Bird farm CodeChef Solution | CodeChef Problem Solution 2022Valentine Vex CodeChef Solution | CodeChef Problem Solution 2022Buying Sweets CodeChef Solution | CodeChef Problem Solution 2022Reduce to 1 CodeChef Solution | CodeChef Problem Solution 2022

### Sample Input 1

2
4
10 4 8 5
9 7 6 6
5 5 7 11
2 1
5
12 44 32 12 32
43 32 12 32 31
34 12 43 23 41
3 4


### Sample Output 1

36
203


### Explanation

Test case $1$: Choose ${A}_{1}=10,{B}_{2}=7,{A}_{3}=8$ and ${C}_{4}=11$, for a sum of $36$.

Test case $2$: Choose ${B}_{1}=43,{A}_{2}=44,{C}_{3}=43,{B}_{4}=32,{C}_{5}=41$, for a sum of $203$.