結果
問題 |
No.198 キャンディー・ボックス2
|
ユーザー |
![]() |
提出日時 | 2015-08-19 22:12:21 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 290 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-07-18 10:35:40 |
合計ジャッジ時間 | 1,230 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 WA * 6 |
ソースコード
b = input() n = input() c = [input() for i in range(n)] lb = 0 ub = (sum(c) + b) / n def sim(x): return sum(abs(y - x) for y in c) for i in range(40): m = lb + (ub - lb) / 2 if sim(lb) < sim(ub): ub = m else: lb = m print(min(sim(lb), sim(ub)))