結果
| 問題 |
No.198 キャンディー・ボックス2
|
| コンテスト | |
| ユーザー |
hiragn
|
| 提出日時 | 2022-11-19 00:08:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 426 bytes |
| コンパイル時間 | 477 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 78,736 KB |
| 最終ジャッジ日時 | 2024-09-20 04:28:30 |
| 合計ジャッジ時間 | 17,729 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | AC * 8 WA * 18 |
ソースコード
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()
hiragn