#P12804. [AMPPZ 2019] Polygon
[AMPPZ 2019] Polygon
Description
You are given segments of lengths , respectively. Determine the largest possible circumference of a convex polygon that can be constructed using these segments (in any order, and not neccessarily all of them). The polygon must be non-degenerate – in other words, its area must be positive.
Input Format
The first line of input contains the number of test cases (). The test cases follow, each one in the following format:
- The first line of a test case contains the number of segments ().
- In the second line, there are integers () – the lengths of the segments.
The sum of values over all test cases does not exceed .
Output Format
For each test case, output a single integer – the largest possible circumference of a convex polygon made of given segments. If no such polygon can be constructed at all, output .
4
6
1 2 3 4 5 6
3
9 5 14
4
5 15 4 6
2
10 11
21
0
15
0
京公网安备 11011102002149号