結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,320 KB
testcase_01 AC 70 ms
71,204 KB
testcase_02 AC 70 ms
71,232 KB
testcase_03 AC 71 ms
71,260 KB
testcase_04 AC 74 ms
71,196 KB
testcase_05 AC 76 ms
71,280 KB
testcase_06 AC 74 ms
71,060 KB
testcase_07 AC 75 ms
71,276 KB
testcase_08 AC 75 ms
71,184 KB
testcase_09 AC 74 ms
71,204 KB
testcase_10 AC 110 ms
89,112 KB
testcase_11 AC 102 ms
87,812 KB
testcase_12 AC 91 ms
83,036 KB
testcase_13 AC 100 ms
86,640 KB
testcase_14 AC 104 ms
89,640 KB
testcase_15 AC 108 ms
91,464 KB
testcase_16 AC 108 ms
91,444 KB
testcase_17 AC 110 ms
91,956 KB
testcase_18 AC 110 ms
91,604 KB
testcase_19 AC 110 ms
91,832 KB
testcase_20 AC 96 ms
92,388 KB
testcase_21 AC 99 ms
91,104 KB
testcase_22 AC 102 ms
92,112 KB
testcase_23 AC 100 ms
91,452 KB
testcase_24 AC 108 ms
91,744 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