#K76012. Maximum Product of Two Integers
Maximum Product of Two Integers
Maximum Product of Two Integers
You are given a list of integers. Your task is to find the maximum product that can be obtained by multiplying any two distinct integers from the list.
More formally, if the list is sorted in non-decreasing order as \(a_1, a_2, \dots, a_n\), then the answer is $$\max\{a_1 \times a_2,\; a_{n-1} \times a_n\}.$$
Note that the list can contain both positive and negative numbers, and the maximum product might come from multiplying two negative numbers.
inputFormat
The input is read from stdin and consists of two lines:
- The first line contains a single integer \(n\) (\(n \ge 2\)) representing the number of integers in the list.
- The second line contains \(n\) space-separated integers.
outputFormat
Output to stdout a single integer, the maximum product of any two distinct integers from the list.
## sample5
1 10 -5 2 7
70