SETTRI


Submit solution

Points: 20
Time limit: 1.0s
Memory limit: 512M

Problem type

Cho số nguyên dương n và dãy số nguyên a1,a2,,an.

Yêu cầu: Tìm 3 chỉ số i,j,k sao cho 1i<j<kn để (aiaj)×(ajak) lớn nhất.

Input

  • Dòng thứ nhất chứa số nguyên dương n(3n106).

  • Dòng thứ hai chứa n số nguyên dương a1,a2,,an(|ai|106).

Output

  • Ghi một số là giá trị (aiaj)×(ajak) lớn nhất tìm được.

Ràng buộc

  • Subtask 1: 50% test n100.

  • Subtask 2: 30% test n5×103.

  • Subtask 3: 20% test n106.

Sample Input

Copy
7
9 12 4 7 5 9 3

Sample Output

Copy
20

Comments

There are no comments at the moment.