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.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$).
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$-10^9 \le a_i \le 10^9$$$).
The third line contains $$$n$$$ integers $$$b_1, b_2, \dots, b_n$$$ ($$$-10^9 \le b_i \le 10^9$$$).
The sum of $$$n$$$ over all test case doesn't exceed $$$2 \cdot 10^5$$$.
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.
332 -1 3-4 0 164 2 -6 1 6 -4-6 -2 -3 7 -3 22-2 -50 -1
6 21 0
Name |
---|