7406: Nailed It!(Problem J5/S3)

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:18 解决:3

题目描述

输入


输出

Output two integers on a single line separated by a single space: the length of the longest fence and the number of different heights a longest fence could have.

样例输入 复制

4
1 2 3 4

样例输出 复制

2 1

提示

Tudor first combines the pieces of wood with lengths 1 and 4 to form a board of length 5.
Then he combines the pieces of wood with lengths 2 and 3 to form another board of length 5.
Finally, he combines the boards to make a fence with length 2 and height 5.