Panda and Maximum product

3.8

18 votes
Ad-Hoc, Basic Programming, Open, Approved, Easy, Mathamatics
Problem

Panda has started learning about subsets. His professor gave him a simple task. Given a list of numbers, Panda has to choose the subset which gives the maximum product. However, the professor asked Panda only to submit the maximum product obtained by taking exactly two numbers from the list. Please help Panda in finding out the answer to this assignment.

Input Format:

The first line will contain the integer N, the length of the array. The next line contains N space separated integers.

Output Format:

For each test case, output Panda's query.

Constraints:

2 <= N <= 105

  • Subtask 1: (25 points)
    0 <= Integers <= 109

  • Subtask 2: (75 points)
    -109 <= Integers <= 109

Time Limit: 3
Memory Limit: 256
Source Limit:
Explanation

The only combination possible is {2,3} whose product is 6 .

Editor Image

?