結果
| 問題 | No.198 キャンディー・ボックス2 |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-03-07 20:36:17 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 483 bytes |
| 記録 | |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 21,340 KB |
| 実行使用メモリ | 16,428 KB |
| 最終ジャッジ日時 | 2026-09-03 07:25:30 |
| 合計ジャッジ時間 | 7,173 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 TLE * 1 -- * 6 |
ソースコード
#!/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 = statistics.median_low(box_candies)
while aim * num_boxes > sum_of_candies:
aim -= 1
print(sum(map(lambda c: abs(c - aim), box_candies)))
if __name__ == '__main__':
main()
はむ吉🐹