結果
| 問題 | 
                            No.3165 [Cherry 7th Tune A] Croissants Continu
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-06-28 10:47:52 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 447 ms / 2,000 ms | 
| コード長 | 223 bytes | 
| コンパイル時間 | 430 ms | 
| コンパイル使用メモリ | 82,652 KB | 
| 実行使用メモリ | 130,224 KB | 
| 最終ジャッジ日時 | 2025-06-28 10:48:01 | 
| 合計ジャッジ時間 | 7,421 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 31 | 
ソースコード
import heapq
T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int,input().split()))
    A = sorted(A)
    a = sum(A[:N-1])
    b = A[-1]
    if b>a:
        print(2*a+1)
    else:
        print(a+b)