結果

問題 No.1071 ベホマラー
ユーザー 👑 KazunKazun
提出日時 2020-06-05 22:14:05
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 98,588 KB
最終ジャッジ日時 2023-08-22 15:56:15
合計ジャッジ時間 4,288 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,328 KB
testcase_01 AC 73 ms
71,528 KB
testcase_02 AC 73 ms
71,188 KB
testcase_03 AC 74 ms
71,316 KB
testcase_04 AC 73 ms
71,216 KB
testcase_05 AC 75 ms
71,544 KB
testcase_06 AC 74 ms
71,432 KB
testcase_07 AC 73 ms
71,564 KB
testcase_08 AC 75 ms
71,232 KB
testcase_09 AC 74 ms
71,516 KB
testcase_10 AC 118 ms
95,228 KB
testcase_11 AC 110 ms
93,184 KB
testcase_12 AC 102 ms
87,140 KB
testcase_13 AC 113 ms
91,208 KB
testcase_14 AC 118 ms
95,632 KB
testcase_15 AC 124 ms
98,464 KB
testcase_16 AC 122 ms
98,532 KB
testcase_17 AC 124 ms
98,272 KB
testcase_18 AC 124 ms
98,468 KB
testcase_19 AC 124 ms
98,588 KB
testcase_20 AC 108 ms
98,220 KB
testcase_21 AC 107 ms
98,184 KB
testcase_22 AC 105 ms
98,192 KB
testcase_23 AC 107 ms
98,152 KB
testcase_24 AC 114 ms
98,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import floor,ceil

N,K,X,Y=map(int,input().split())
A=list(map(int,input().split()))
D=set()

B=[]
for i in range(N):
    x=ceil((A[i]-1)/K)
    B.append(x)

B.sort()

T=min(floor(Y/X),N)

if T==N:
    print(sum(B)*X)
else:
    P=B[N-1-T]
    S=P*Y
    for b in B:
        S+=max(0,b-P)*X

    print(S)
0