#P1284. 三角形牧场

三角形牧场

Description

Like everyone, cows enjoy variety. They are imagining a new look for their pastures. The cow architect Hei wants to build a triangular pasture enclosed by a beautiful white fence. She has nn boards, each with an integer length lil_i, and she wants to use all the boards to enclose a triangle so that the pasture area is maximized.

Please help Miss Hei construct such a pasture and compute this maximum area.

Input Format

Line 11: an integer nn.

Lines 22 to (n+1)(n + 1): each line contains one integer. On line (i+1)(i + 1), the integer lil_i denotes the length of the ii-th board.

Output Format

A single integer: the result of multiplying the maximum pasture area by 100100 and then truncating the fractional part. If it is impossible to construct, output 1-1.

5
1
1
3
3
4

692

Hint

Explanation for Sample Input/Output 1: $692=\text{truncated}(100\times\text{triangle area})$, and the triangle is equilateral with side length 44.

Constraints: For 100%100\% of the testdata, it is guaranteed that 3n403 \le n \le 40, 1li401 \le l_i \le 40.

Translated by ChatGPT 5