結果
問題 | No.198 キャンディー・ボックス2 |
ユーザー |
👑 |
提出日時 | 2022-11-19 00:08:58 |
言語 | Python3 (3.10.1 + numpy 1.22.3 + scipy 1.8.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 426 bytes |
コンパイル時間 | 64 ms |
使用メモリ | 57,140 KB |
最終ジャッジ日時 | 2023-03-28 14:35:46 |
合計ジャッジ時間 | 7,746 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 543 ms
28,500 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 133 ms
28,596 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 131 ms
28,752 KB |
testcase_20 | WA | - |
testcase_21 | AC | 131 ms
28,492 KB |
testcase_22 | WA | - |
testcase_23 | AC | 133 ms
28,616 KB |
testcase_24 | WA | - |
testcase_25 | AC | 132 ms
28,592 KB |
testcase_26 | AC | 131 ms
28,796 KB |
testcase_27 | WA | - |
testcase_28 | AC | 130 ms
28,772 KB |
testcase_29 | WA | - |
ソースコード
import numpy as np def main(): b = int(input()) n = int(input()) c = np.array([int(input()) for _ in range(n)], dtype='int64') # bが小さいと中央値np.median(c)を実現できない。 # n * x = sum(c) + bをみたすxと中央値の小さい方を作る x = min(np.median(c), (np.sum(c) + b) // n) ans = sum([abs(i - x) for i in c]) print(ans) if __name__ == "__main__": main()