#K69867. Maximum Swappable Product

    ID: 33182 Type: Default 1000ms 256MiB

Maximum Swappable Product

Maximum Swappable Product

In this problem, you are given several test cases. In each test case, you have an array of integers. Your task is to determine the maximum product obtainable by choosing two distinct elements from the array. Formally, for an array (a_1, a_2, \dots, a_N), you must compute (\max_{1 \le i < j \le N} (a_i \times a_j)).

Note: Input is provided via stdin and output should be printed to stdout.

inputFormat

The input begins with an integer (T) denoting the number of test cases. Each test case starts with an integer (N) which represents the number of elements in the array, followed by a line containing (N) space-separated integers.

outputFormat

For each test case, print a single line containing the maximum product of any two distinct elements from the array.## sample

2
5
3 6 2 8 1
4
1 3 2 4
48

12

</p>