Submit solution

Points:
25 (partial)

Time limit:
1.0s

Memory limit:
512M

Problem type

Allowed languages

Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, ~~CommonLisp~~, D, Dart, F#, Forth, Fortran, Go, ~~Groovy~~, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, ~~Nim~~, ~~ObjC~~, OCaml, ~~Octave~~, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Given two positive integer sequences and of length , you must find two sequences and of length satisfying the following conditions:

- .
- .
- .

Subject to these conditions, maximize .

#### Input Specification

The first line contains an integer , indicating the number of testcases.

For each testcase:

The first line contains three integers .

The second line contains integers, indicating .

The third line contains integers, indicating .

#### Constraints

For all test cases, .

Test Case | ||
---|---|---|

1~3 | ||

4~5 | ||

6~7 | ||

8~10 | ||

11~16 | ||

17~21 | ||

22~25 |

#### Output Specification

Output one integer on one line, the answer.

#### Sample Input 1

```
5
1 1 1
7
7
3 2 1
4 1 2
1 4 2
5 2 1
4 5 5 8 4
2 1 7 2 7
6 4 1
1 5 8 3 2 4
2 6 9 3 1 7
7 5 4
1 6 6 6 5 9 1
9 5 3 9 1 4 2
```

#### Sample Output 1

```
14
12
27
45
62
```

## Comments