結果

問題 No.1071 ベホマラー
ユーザー mlihua09mlihua09
提出日時 2020-09-20 17:35:41
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 370 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 92,472 KB
最終ジャッジ日時 2023-09-06 16:25:15
合計ジャッジ時間 4,881 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,236 KB
testcase_01 RE -
testcase_02 AC 71 ms
71,184 KB
testcase_03 AC 71 ms
71,480 KB
testcase_04 AC 72 ms
71,316 KB
testcase_05 AC 69 ms
71,360 KB
testcase_06 AC 71 ms
71,180 KB
testcase_07 AC 72 ms
71,032 KB
testcase_08 AC 71 ms
71,336 KB
testcase_09 AC 71 ms
71,504 KB
testcase_10 AC 103 ms
89,264 KB
testcase_11 AC 101 ms
88,028 KB
testcase_12 AC 93 ms
83,372 KB
testcase_13 AC 102 ms
86,668 KB
testcase_14 AC 108 ms
89,896 KB
testcase_15 AC 112 ms
91,564 KB
testcase_16 AC 109 ms
91,412 KB
testcase_17 AC 111 ms
92,076 KB
testcase_18 AC 111 ms
92,064 KB
testcase_19 AC 112 ms
91,680 KB
testcase_20 RE -
testcase_21 AC 95 ms
91,060 KB
testcase_22 RE -
testcase_23 AC 99 ms
91,408 KB
testcase_24 AC 105 ms
92,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


N, K, X, Y = map(int, input().split())

A = list(map(lambda x: int(x) - 1, input().split()))

A.sort()

n = Y // X
if n < N:
    
    x = (A[N - n - 1] - 1) // K + 1
    
    ans = x * Y
    
    
    for i in range(N - n, N):
        
        ans += ((A[i] - 1) // K + 1 - x) * X
    
    print(ans)
    
else:
    
    print(sum([((a - 1) // K + 1) * x for a in A]))
0