結果
問題 | No.198 キャンディー・ボックス2 |
ユーザー |
![]() |
提出日時 | 2021-01-09 00:07:44 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 270 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-16 19:22:33 |
合計ジャッジ時間 | 2,421 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 8 |
ソースコード
B, M, *C = map(int, open(0).read().split()) l = min(C) r = (sum(C) + B) // M for _ in range(1000): nl = (l * 2 + r) // 3 nr = (l + r * 2) // 3 a = sum(abs(c - nl) for c in C) b = sum(abs(c - nr) for c in C) if a < b: r = nr else: l = nl print(min(sum(abs(c - l) for c in C), sum(abs(c - r) for c in C)))