There are two sequences of positive integers
Formally, you are to choose two sets
The first line of input consists of a single integer
The first line of each testcase will contain 3 integers,
The second line of each testcase will contain
The third line of each testcase will contain
Output one line for each testcase, each containing a single integer - the maximum sum of elements as described.
Subtask # | Score | Constraints |
---|---|---|
1 | 12 | |
2 | 8 | |
3 | 8 | |
4 | 12 | |
5 | 24 | |
6 | 20 | |
7 | 16 | No additional constraints |
Sample Input 1 | Sample Output 1 |
5
|
14
|
The optimal solution for the first testcase is
An optimal solution for the second testcase is
The optimal solution for the third testcase is
The optimal solution for the fourth testcase is
The optimal solution for the fifth testcase is
Subtask | Score |
---|---|
1 | 12 |
2 | 8 |
3 | 8 |
4 | 12 |
5 | 24 |
6 | 20 |
7 | 16 |