시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
3 초 | 512 MB | 40 | 13 | 13 | 39.394% |
There are $N$ sticks. The length of the $i$-th stick is $a_i$. You want to choose six sticks and construct two triangles. Each stick should be used as an edge of one of the triangles. Also, the triangles should be non-degenerate.
Compute the maximum possible total length of the six chosen sticks. If two triangles can not be constructed this way, assume the total length is 0.
The first line contains an integer $N$ ($1 \le N \le 10^5$). The $i$-th of the next $N$ lines contains an integer $a_i$ ($1 \le a_i \le 10^{15}$).
Print the answer.
6 1 1 1 1 1 1
6