結果

問題 No.1071 ベホマラー
ユーザー maspy
提出日時 2020-06-05 22:42:22
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 390 ms / 2,000 ms
+ 226µs
コード長 512 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 83 ms
コンパイル使用メモリ 14,592 KB
実行使用メモリ 43,036 KB
最終ジャッジ日時 2026-10-30 01:29:21
合計ジャッジ時間 13,731 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, X, Y = map(int, readline().split())
A = np.array(read().split(), np.int64)

# 必要回数になおす
A -= 1
A = (A + K - 1) // K

A.sort()
A = A[::-1]
A = np.append(A, 0)

Acum = np.cumsum(A)
cntX = Acum - np.arange(1, N + 2, dtype=np.int64) * A
cntY = A

cntX = cntX.tolist()
cntY = cntY.tolist()
answer = min(x * X + y * Y for x, y in zip(cntX, cntY))
print(answer)
0