結果

問題 No.1071 ベホマラー
ユーザー ka_zuka_zu
提出日時 2020-06-05 21:52:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 99,348 KB
最終ジャッジ日時 2023-08-22 15:11:03
合計ジャッジ時間 4,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,212 KB
testcase_01 AC 72 ms
71,300 KB
testcase_02 AC 72 ms
71,552 KB
testcase_03 AC 72 ms
71,588 KB
testcase_04 AC 70 ms
71,552 KB
testcase_05 AC 72 ms
71,516 KB
testcase_06 AC 72 ms
71,360 KB
testcase_07 AC 71 ms
71,300 KB
testcase_08 AC 73 ms
71,084 KB
testcase_09 AC 72 ms
71,548 KB
testcase_10 AC 114 ms
95,216 KB
testcase_11 AC 111 ms
93,356 KB
testcase_12 AC 101 ms
86,808 KB
testcase_13 AC 111 ms
91,624 KB
testcase_14 AC 116 ms
95,628 KB
testcase_15 AC 120 ms
98,536 KB
testcase_16 AC 122 ms
98,360 KB
testcase_17 AC 121 ms
99,088 KB
testcase_18 AC 123 ms
99,348 KB
testcase_19 AC 122 ms
98,736 KB
testcase_20 AC 105 ms
98,316 KB
testcase_21 AC 104 ms
98,008 KB
testcase_22 AC 106 ms
98,284 KB
testcase_23 AC 106 ms
98,928 KB
testcase_24 AC 111 ms
98,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N, K, X, Y = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
C = []
for i in range(N):
    C.append(math.ceil((A[i]-1)/ K))

cnt = math.ceil(Y / X)#これ未満はベホイミのほうが良い
if cnt > N:
    print(sum(C) * X)
    exit()
else:
    B = C[-cnt]
    #print("A = ",A)
    #print("cnt = ", cnt)
    #print("B = ",B)
    #print("C = ",C)
    #print(C[-cnt:])
    ans = 0
    ans += B * Y
    tmp = sum(C[-cnt:]) - B *cnt
    ans += tmp * X
    print(ans)
0