CF2149B.Unconventional Pairs

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Unconventional Pairs

A popular reality show Unconventional Pairs has been launched in the city. According to the rules of the show, participants are paired in an unusual way: with an even number of people, all participants must be in pairs.

Petya has an array of nn integers a1,a2,,ana_1,a_2,\dots ,a_n. It is known that nn is even. Petya must divide the participants (numbers) into exactly n2\large\frac{n}{2} pairs $(a_{p_1},a_{q_1}),\,(a_{p_2},a_{q_2}),\dots\,(a_{p_\frac{n}{2}},a_{q_\frac{n}{2}})$. Each index can be included in no more than one pair.

For a pair (x,y)(x,y), its difference is defined as xy|x-y|. Petya wants to form unconventional pairs such that the maximum difference among all pairs is minimized.

Determine the minimum possible value of this maximum difference.

Input

Each test consists of several test cases.

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases. The description of the test cases follows.

The first line of each test case contains one even number nn (2n21052 \le n \le 2 \cdot 10^5) — the length of the array aa.

The second line contains nn integers a1,a2,,ana_1,a_2,\dots ,a_n (109ai109)(-10^{9} \le a_i \le 10^{9}) — the elements of the array aa.

It is guaranteed that the sum of the values of nn across all test cases does not exceed 21052 \cdot 10^5.

Output

For each test case, output a single number — the minimum possible maximum difference between the elements in pairs.

Note

In the first test case, the array is: [1,2][1,2]. The only possible (and therefore optimal) pair is (1,2)(1,2), its difference is 12=1|1-2| = 1, the answer is 11.

In the second test case, the array is: [10,1,2,9][10,1,2,9]. We can choose pairs — (1,2)(1,2) and (9,10)(9,10): both differences are equal to 11, therefore, the maximum difference is 11.

In the third test case, the array is: [3,8,9,3,3,2][3,8,9,3,3,2]. We can choose pairs: (2,3)(2,3), (3,3)(3,3), (8,9)(8,9). The differences are: 1,0,11,0,1 — the largest is 11.

Samples

5
2
1 2
4
10 1 2 9
6
3 8 9 3 3 2
8
5 5 5 5 5 5 5 5
4
-5 -1 2 6
1
1
1
0
4

在线编程 IDE

建议全屏模式获得最佳体验