結果
問題 | No.198 キャンディー・ボックス2 |
ユーザー |
![]() |
提出日時 | 2016-03-07 20:38:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 50 ms / 1,000 ms |
コード長 | 456 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 13,952 KB |
最終ジャッジ日時 | 2024-11-16 09:55:12 |
合計ジャッジ時間 | 2,792 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array import statistics def main(): num_a_cand = int(input()) num_boxes = int(input()) box_candies = array.array("L", (int(input()) for _ in range(num_boxes))) sum_of_candies = num_a_cand + sum(box_candies) aim = min(statistics.median_low(box_candies), sum_of_candies // num_boxes) print(sum(map(lambda c: abs(c - aim), box_candies))) if __name__ == '__main__': main()