#P1910E. Maximum Sum Subarrays
Maximum Sum Subarrays
Description
You are given two integer arrays and , both of length .
You can perform the following operation any number of times (possibly zero): swap and .
Let be the maximum sum of a contiguous subarray of the array (including the empty subsegment, which sum is ).
Your task is to calculate the maximum possible value of , using the aforementioned operation any number of times.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line contains integers ().
The third line contains integers ().
The sum of over all test case doesn't exceed .
For each test case, print a single integer — the maximum possible value of , using the aforementioned operation any number of times.
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line contains integers ().
The third line contains integers ().
The sum of over all test case doesn't exceed .
Output
For each test case, print a single integer — the maximum possible value of , using the aforementioned operation any number of times.