結果

問題 No.198 キャンディー・ボックス2
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-03-07 18:09:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 11,728 KB
実行使用メモリ 13,072 KB
最終ジャッジ日時 2023-10-24 20:14:57
合計ジャッジ時間 3,289 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
13,072 KB
testcase_01 AC 43 ms
13,072 KB
testcase_02 AC 42 ms
13,072 KB
testcase_03 AC 43 ms
13,072 KB
testcase_04 AC 43 ms
13,072 KB
testcase_05 AC 42 ms
13,072 KB
testcase_06 AC 42 ms
13,072 KB
testcase_07 AC 42 ms
13,072 KB
testcase_08 AC 42 ms
13,072 KB
testcase_09 AC 43 ms
13,072 KB
testcase_10 AC 43 ms
13,072 KB
testcase_11 AC 43 ms
13,072 KB
testcase_12 AC 42 ms
13,072 KB
testcase_13 AC 43 ms
13,072 KB
testcase_14 AC 43 ms
13,072 KB
testcase_15 AC 43 ms
13,072 KB
testcase_16 AC 43 ms
13,072 KB
testcase_17 AC 42 ms
13,072 KB
testcase_18 AC 42 ms
13,072 KB
testcase_19 WA -
testcase_20 AC 43 ms
13,072 KB
testcase_21 WA -
testcase_22 AC 42 ms
13,072 KB
testcase_23 WA -
testcase_24 AC 42 ms
13,072 KB
testcase_25 WA -
testcase_26 AC 43 ms
13,072 KB
testcase_27 AC 42 ms
13,072 KB
testcase_28 WA -
testcase_29 AC 43 ms
13,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
import statistics


def solve(candies):
    median = statistics.median_low(candies)
    return sum(map(lambda c: abs(c - median), candies))


def main():
    b = int(input())
    n = int(input())
    candies = array.array("L", (int(input()) for _ in range(n)))
    print(solve(candies))


if __name__ == '__main__':
    main()
0