結果
| 問題 |
No.198 キャンディー・ボックス2
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-03-07 20:36:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 483 bytes |
| コンパイル時間 | 203 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 20,896 KB |
| 最終ジャッジ日時 | 2024-09-24 15:11:56 |
| 合計ジャッジ時間 | 4,526 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 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()
はむ吉🐹