結果
| 問題 | No.198 キャンディー・ボックス2 |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-03-07 20:38:26 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 1,000 ms |
| コード長 | 456 bytes |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 14,336 KB |
| 最終ジャッジ日時 | 2025-11-26 11:39:36 |
| 合計ジャッジ時間 | 3,233 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
ソースコード
#!/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()
はむ吉🐹