結果

問題 No.1071 ベホマラー
ユーザー 👑 H20H20
提出日時 2021-01-05 10:17:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 303 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 91,648 KB
最終ジャッジ日時 2024-04-23 16:35:37
合計ジャッジ時間 3,217 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 37 ms
51,456 KB
testcase_02 AC 38 ms
51,712 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 37 ms
51,968 KB
testcase_05 AC 37 ms
52,096 KB
testcase_06 AC 37 ms
51,968 KB
testcase_07 AC 35 ms
51,968 KB
testcase_08 AC 37 ms
51,944 KB
testcase_09 AC 37 ms
51,840 KB
testcase_10 AC 88 ms
89,344 KB
testcase_11 AC 86 ms
88,192 KB
testcase_12 AC 71 ms
81,664 KB
testcase_13 AC 74 ms
79,488 KB
testcase_14 AC 85 ms
86,272 KB
testcase_15 AC 89 ms
89,600 KB
testcase_16 AC 97 ms
91,648 KB
testcase_17 AC 87 ms
87,356 KB
testcase_18 AC 87 ms
87,040 KB
testcase_19 AC 87 ms
87,296 KB
testcase_20 AC 70 ms
85,888 KB
testcase_21 AC 69 ms
86,016 KB
testcase_22 AC 68 ms
86,016 KB
testcase_23 AC 69 ms
85,632 KB
testcase_24 AC 78 ms
87,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,X,Y = map(int,input().split())
A = list(map(int,input().split()))
AK = [0]*(N+1)
for i in range(N):
    AK[i] = -(-(A[i]-1)//K)
AK.sort()
SAK = sum(AK)
ans = SAK*X
behoi = SAK
for i in range(N):
    behoi -= (AK[i+1]-AK[i])*(N-i)
    behoma = AK[i+1] 
    ans = min(ans,behoi*X+behoma*Y)

print(ans)
0