結果
問題 |
No.3165 [Cherry 7th Tune A] Croissants Continu
|
ユーザー |
|
提出日時 | 2025-05-31 16:39:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 808 ms / 2,000 ms |
コード長 | 339 bytes |
コンパイル時間 | 505 ms |
コンパイル使用メモリ | 82,336 KB |
実行使用メモリ | 123,880 KB |
最終ジャッジ日時 | 2025-05-31 16:39:48 |
合計ジャッジ時間 | 7,745 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
t=int(input()) def judge(x): s=0 for i in a: s+=min(i,x) return x*2<=s for _ in range(t): n=int(input()) a=[*map(int,input().split())] ok,ng=0,1<<60 while abs(ok-ng)>1: mid=ok+ng>>1 if judge(mid): ok=mid else: ng=mid ans=f=0 for i in a: ans+=min(i,ok) if i>ok: f=1 print(ans+f)