結果
問題 | No.198 キャンディー・ボックス2 |
ユーザー |
![]() |
提出日時 | 2021-03-14 20:57:34 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 84,336 KB |
最終ジャッジ日時 | 2024-11-06 09:42:39 |
合計ジャッジ時間 | 3,940 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 WA * 9 RE * 3 |
ソースコード
b=int(input()) n=int(input()) c=[int(input()) for i in range(n)] c.sort() if n//2==1: t=c[n//2] else: t=(c[n//2-1]+c[n//2])//2 x=sum(c)+b ans=[] for i in range(max(t-10**5,0),t+10**5): ct=0 y=b for j in range(n): if c[j]>=i: ct+=c[j]-i y+=c[j]-i for j in range(n): if c[j]<i: ct+=i-c[j] y-=i-c[j] if y>=0: ans.append(ct) print(min(ans))