結果

問題 No.3165 [Cherry 7th Tune A] Croissants Continu
ユーザー norioc
提出日時 2025-06-11 22:00:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 82,724 KB
実行使用メモリ 127,964 KB
最終ジャッジ日時 2025-06-11 22:00:14
合計ジャッジ時間 9,832 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    xs = sorted(A)
    a = xs.pop()
    rest = max(0, a - sum(xs) - 1)
    return sum(A) - rest


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