結果

問題 No.3165 [Cherry 7th Tune A] Croissants Continu
ユーザー Kude
提出日時 2025-05-30 22:48:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 371 ms / 2,000 ms
コード長 224 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 124,800 KB
最終ジャッジ日時 2025-05-30 22:48:25
合計ジャッジ時間 7,889 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n = int(input())
    a = sorted(map(int, input().split()))
    mx = a.pop()
    if n == 1:
        print(1)
        continue
    rest = sum(a)
    mx = min(rest + 1, mx)
    print(mx + rest)
0