結果

問題 No.1071 ベホマラー
ユーザー maspymaspy
提出日時 2020-06-05 22:42:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 665 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 50,160 KB
最終ジャッジ日時 2024-05-09 22:21:40
合計ジャッジ時間 17,328 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 561 ms
43,708 KB
testcase_01 AC 564 ms
44,088 KB
testcase_02 AC 558 ms
43,704 KB
testcase_03 AC 548 ms
43,580 KB
testcase_04 AC 569 ms
44,088 KB
testcase_05 AC 548 ms
43,576 KB
testcase_06 AC 535 ms
44,088 KB
testcase_07 AC 528 ms
44,084 KB
testcase_08 AC 550 ms
44,092 KB
testcase_09 AC 546 ms
43,964 KB
testcase_10 AC 665 ms
48,508 KB
testcase_11 AC 597 ms
48,576 KB
testcase_12 AC 584 ms
46,520 KB
testcase_13 AC 599 ms
47,544 KB
testcase_14 AC 603 ms
48,896 KB
testcase_15 AC 619 ms
49,728 KB
testcase_16 AC 623 ms
49,644 KB
testcase_17 AC 628 ms
50,160 KB
testcase_18 AC 628 ms
50,160 KB
testcase_19 AC 626 ms
49,980 KB
testcase_20 AC 646 ms
48,184 KB
testcase_21 AC 648 ms
48,168 KB
testcase_22 AC 615 ms
47,928 KB
testcase_23 AC 605 ms
47,932 KB
testcase_24 AC 632 ms
50,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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