题目描述
Suppose n children are playing in the forest. Suddenly one of them notices a Lion roaming around them.
Child alerts the other children.
Now they have two options. Either they will climb the trees to ensure their safety or they will dig a hole in ground and will hide in it.
Children and trees are placed on x-axis. There are n trees on this line. Each tree can accommodate only 1 child.
So every child have to select a tree and climb on it. If a child is at position x1 and tree is at position x2 then it will take |x1-x2| minutes to reach the tree (You
can assume that time for climbing the tree is negligible).
We have to assign children to trees so that the time before which all the children have climbed the trees is minimized. You have to find this minimum time.
Now as a second option they can dig a hole in ground. They will select some position on ground for their hole and all children will have to move to that position.
If a child is currently at position x1 and he has to move to position x2 then |x1-x2| units of energy will be consumed. You have to tell appropriate position for hole
so that total energy consumption of all the children is minimized. If there are more than one positions possible, output the leftmost (minimum one).
Input:
The first line contains an integer T, the number of test cases. This is followed by T blocks of input:
First line contains one positive integers n denoting the number of children and trees.
Next line contains n space separated integers, denoting the positions of the children.
Next line contains n space separated integers, denoting the positions of the trees.
Output:
For each test case, print the minimum time before which all the children have climbed the tree. And in next line print the position of hole.
Constraints:
1 ≤ T ≤ 15
1 ≤ n ≤ 10^5
-100 ≤ children[i] ≤ 100
-100 ≤ tree[i] ≤ 100
SAMPLE INPUT
1
4
2 0 -4 5
3 1 2 9
SAMPLE OUTPUT
5
0
输入格式
见题面
输出格式
见题面