Problem: You are given two arrays and of length . Array contains each odd integer from to in an arbitrary order, and array contains each even integer from to in an arbitrary order.
You can perform the following operation on those arrays:
- choose one of the two arrays
- pick an index from to
- swap the -th and the -th elements of the chosen array
For two different arrays and of the same length , we say that is lexicographically smaller than if in the first position where and differ, the array has a smaller element than the corresponding element in .
Input Format: Each test contains multiple test cases. The first line contains the number of test cases ().
The first line of each test case contains a single integer () — the length of the arrays.
The second line of each test case contains integers (, all are odd and pairwise distinct) — array .
The third line of each test case contains integers (, all are even and pairwise distinct) — array .
It is guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case, print one integer: the minimum number of operations needed to make array lexicographically smaller than array .
We can show that an answer always exists.
Note: In the first example, the array is already lexicographically smaller than array , so no operations are required.
In the second example, we can swap and and then swap and , which results in and . Another correct way is to swap and and then swap and , which results in and . Yet another correct way is to swap and and then swap and , which results in and .