传统题 1000ms 256MiB

The Enigmatic Integer List

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Description

In a distant, mystical land known as Numeria, there lies a peculiar village called Arithmetica. The villagers of Arithmetica are avid mathematicians, and they love playing mathematical games. In the heart of this village, there stands an ancient and enigmatic Tree of Numbers.

The Tree of Numbers is rumored to possess magical properties, granting great power to those who can decipher its secrets. Legend has it that if you present the Tree with a list of (n) integers, it will reveal the maximum possible product of two numbers from the list.

Now, you've been entrusted with a quest: help the villagers of Arithmetica by writing a program to unveil the Tree's mysteries and find the maximum product of two numbers from a given list.

Input Format

The first line contains an integer, nn (2≤n≤50002 \leq n \leq 5000), representing the number of integers in the list. The second line contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n (−5×105≤ai≤5×105-5 \times 10^5 \leq a_i \leq 5 \times 10^5), separated by spaces. These integers represent the offerings to the Tree of Numbers.

Output Format

Output a single number, the maximum product of two numbers that can be obtained from the given list.

Sample

样例输入

6
1 2 3 4 5 6

样例输出

30

Hint

For all test cases, 2≤n≤50002 \leq n \leq 5000, and −5×105≤ai≤5×105-5 \times 10^5 \leq a_i \leq 5 \times 10^5.

重庆邮电大学第十六届ACM程序设计大赛(网络赛)

未参加
状态
已结束
规则
XCPC
题目
11
开始于
2023-9-23 0:00
结束于
2023-9-25 0:00
持续时间
48 小时
主持人
参赛人数
2