結果

問題 No.1071 ベホマラー
ユーザー syunsukesyunsuke
提出日時 2020-09-01 23:00:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 98,244 KB
最終ジャッジ日時 2023-08-13 03:49:26
合計ジャッジ時間 5,669 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,468 KB
testcase_01 AC 69 ms
71,064 KB
testcase_02 AC 70 ms
71,412 KB
testcase_03 AC 68 ms
71,396 KB
testcase_04 AC 68 ms
70,936 KB
testcase_05 AC 68 ms
71,440 KB
testcase_06 AC 68 ms
71,468 KB
testcase_07 AC 69 ms
71,204 KB
testcase_08 AC 70 ms
71,396 KB
testcase_09 AC 69 ms
71,372 KB
testcase_10 AC 113 ms
95,088 KB
testcase_11 AC 108 ms
93,196 KB
testcase_12 AC 100 ms
86,780 KB
testcase_13 AC 110 ms
90,900 KB
testcase_14 AC 114 ms
95,272 KB
testcase_15 AC 121 ms
97,988 KB
testcase_16 AC 121 ms
98,096 KB
testcase_17 AC 123 ms
98,244 KB
testcase_18 AC 120 ms
98,168 KB
testcase_19 AC 117 ms
97,956 KB
testcase_20 AC 98 ms
97,884 KB
testcase_21 AC 101 ms
97,876 KB
testcase_22 AC 99 ms
97,836 KB
testcase_23 AC 102 ms
97,868 KB
testcase_24 AC 108 ms
98,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,X,Y=map(int,input().split())
a=list(map(int,input().split()))
import math
A=[]
for i in range(N):
    A.append((a[i]-1)//K)
    if (a[i]-1)%K!=0:
        A[-1]+=1
#print(A)
M=int(Y/X)
A.sort(reverse=True)
if M>N-1:
    print(sum(A)*X)
else:
    ans=A[M]
    ANS=Y*ans
    #print(ANS)
    for i in range(N):
        A[i]=max(0,A[i]-ans)
    ANS+=X*sum(A)
    print(ANS)
0