#C12880. Maximum Pair Product

    ID: 42356 Type: Default 1000ms 256MiB

Maximum Pair Product

Maximum Pair Product

You are given a list of integers. Your task is to find the maximum product of any two distinct numbers from the list. Formally, given a list \(a_1, a_2, \ldots, a_n\), you need to compute:

[ \max( a_i \times a_j )\quad \text{for}\quad 1 \le i < j \le n ]

If there are fewer than two numbers in the list, output None to indicate that no product can be computed.

Example:

  • For the list [3, 6, 8, 1, 5], the answer is 48 since \(8 \times 6 = 48\) is the maximum product.
  • For the list [-10, -20, 5, 6], the answer is 200 since \((-10) \times (-20) = 200\).

inputFormat

The input is given in two lines:

  1. The first line contains an integer \(n\) representing the number of elements in the list.
  2. The second line contains \(n\) space-separated integers.

If \(n\) is less than 2, no further input will be provided.

outputFormat

Output a single line containing the maximum product of any two distinct numbers. If there are fewer than two numbers, output None.

## sample
5
3 6 8 1 5
48