結果

問題 No.1071 ベホマラー
ユーザー GeckoちゃんGeckoちゃん
提出日時 2020-06-23 13:47:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 19,364 KB
最終ジャッジ日時 2023-09-16 19:53:44
合計ジャッジ時間 2,778 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,956 KB
testcase_01 AC 16 ms
7,932 KB
testcase_02 AC 17 ms
8,356 KB
testcase_03 AC 16 ms
7,900 KB
testcase_04 AC 16 ms
7,924 KB
testcase_05 AC 17 ms
7,868 KB
testcase_06 AC 16 ms
8,044 KB
testcase_07 AC 16 ms
8,044 KB
testcase_08 AC 17 ms
8,044 KB
testcase_09 AC 17 ms
7,928 KB
testcase_10 AC 78 ms
17,324 KB
testcase_11 AC 76 ms
16,740 KB
testcase_12 AC 55 ms
13,784 KB
testcase_13 AC 73 ms
15,864 KB
testcase_14 AC 81 ms
17,620 KB
testcase_15 AC 89 ms
19,188 KB
testcase_16 AC 90 ms
19,364 KB
testcase_17 AC 99 ms
19,176 KB
testcase_18 AC 101 ms
19,184 KB
testcase_19 AC 96 ms
19,300 KB
testcase_20 AC 76 ms
19,044 KB
testcase_21 AC 71 ms
18,896 KB
testcase_22 AC 77 ms
19,044 KB
testcase_23 AC 79 ms
19,104 KB
testcase_24 AC 83 ms
19,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N,K,X,Y=map(int,input().split())
Ax=list(map(lambda x:int(x),input().split()))

B=[(a-1+K-1)//K for a in Ax]
B.sort(reverse=True)
if Y <= X:
    print(Y*B[0])
    exit()

t = math.ceil(Y/X)-1
if t<N:
    print(Y * B[t] + X * sum(B[i] - B[t] for i in range(t)))
else:
    print(X * sum(B[i] for i in range(N)))
0