Logo
(追記) (追記ここまで)

18044번 - Polygon 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB139827360.833%

문제

You are given n segments of lengths l1, l2, . . . , ln, 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.

입력

The first line of input contains the number of test cases z (1 ≤ z ≤ 100 000). The test cases follow, each one in the following format:

The first line of a test case contains the number of segments n (1 ≤ n ≤ 100 000). In the second line, there are n integers l1, l2, . . . , ln (1 ≤ li ≤ 109 ) – the lengths of the segments.

The sum of n values over all test cases does not exceed 1 000 000.

출력

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 0.

제한

예제 입력 1

4
6
1 2 3 4 5 6
3
9 5 14
4
5 15 4 6
2
10 11

예제 출력 1

21
0
15
0

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > Poland Collegiate Programming Contest > AMPPZ 2019 C번

Contest > Open Cup > 2019/2020 Season > Stage 8: Grand Prix of Poland C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /