Garden Bed | 프로그래밍의 벗 PivotOJ
PivotOJ

Garden Bed

시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC 2025-2026 Northwestern Russia QualificationBOJ 35008

문제

In a wonderful land where the sun shines brighter and flowers grow more lushly, there lived a kind gardener named Nikolay. He eagerly awaited the time to open the gardening season and engage in his favorite activity: cultivating garden beds.

One day, gathering his strength, Nikolay brought a few magical pairs of boards with him. Boards from the same pair had the same length, whereas boards from different pairs may have had different lengths. Nikolay dreamed of creating a beautiful rectangular garden bed where the prettiest vegetables and flowers would grow. For that, he needed to use all his boards without cutting them, placing paired boards on the opposite sides of the rectangle.

And so, standing in front of his garden, Nikolay pondered: "What can be the area of a beautiful garden bed?" Help him determine the minimum and maximum positive area he could obtain.

입력

The first line contains an integer nn: the number of pairs of boards (2n72 \le n \le 7).

The second line contains nn integers: the lengths of boards in the first, second, \ldots, nn-th pair. Each length is an integer from 11 to 10810^8.

출력

Output two integers: the minimum and maximum area of a beautiful garden bed.

예제

예제 1

입력
2
10 239
출력
2390 2390

예제 2

입력
3
1 2 2
출력
4 6
코드를 제출하려면 로그인하세요.