結果

問題 No.3165 [Cherry 7th Tune A] Croissants Continu
ユーザー norioc
提出日時 2025-06-12 02:16:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 415 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 123,568 KB
最終ジャッジ日時 2025-06-12 02:16:34
合計ジャッジ時間 6,334 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N = int(input())
    A = list(map(int, input().split()))

    tot = sum(A)
    a = max(A)
    b = tot - a
    rest = max(0, a - b - 1)
    return tot - rest


T = int(input())
for _ in range(T):
    ans = solve()
    print(ans)
0