← Home
write a go solution for Description:
You are given two integer arrays a and b, both of length n.

You can perform the following operation any number of times (possibly zero): swap a_i and b_i.

Let f(c) be the maximum sum of a contiguous subarray of the array c (including the empty subsegment, which sum is 0).

Your task is to calculate the maximum possible value of f(a)+f(b), using the aforementioned operation any number of times.

Input Format:
The first line contains a single integer t (1<=t<=10^4) — the number of test cases.

The first line of each test case contains a single integer n (1<=n<=2*10^5).

The second line contains n integers a_1,a_2,...,a_n (-10^9<=a_i<=10^9).

The third line contains n integers b_1,b_2,...,b_n (-10^9<=b_i<=10^9).

The sum of n over all test case doesn't exceed 2*10^5.

Output Format:
For each test case, print a single integer — the maximum possible value of f(a)+f(b), using the aforementioned operation any number of times.

Note:
None. Output only the code with no comments, explanation, or additional text.