結果

問題 No.1071 ベホマラー
ユーザー 👑 timitimi
提出日時 2020-10-07 17:29:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 19,228 KB
最終ジャッジ日時 2023-09-27 09:20:12
合計ジャッジ時間 3,946 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,868 KB
testcase_01 AC 16 ms
7,824 KB
testcase_02 AC 16 ms
8,104 KB
testcase_03 AC 16 ms
7,876 KB
testcase_04 AC 15 ms
7,872 KB
testcase_05 AC 16 ms
7,824 KB
testcase_06 AC 16 ms
7,820 KB
testcase_07 AC 16 ms
7,756 KB
testcase_08 AC 16 ms
7,820 KB
testcase_09 AC 16 ms
7,812 KB
testcase_10 AC 124 ms
17,196 KB
testcase_11 AC 84 ms
16,688 KB
testcase_12 AC 81 ms
13,720 KB
testcase_13 AC 111 ms
15,768 KB
testcase_14 AC 132 ms
17,412 KB
testcase_15 AC 151 ms
19,228 KB
testcase_16 AC 147 ms
19,108 KB
testcase_17 AC 153 ms
19,092 KB
testcase_18 AC 151 ms
18,844 KB
testcase_19 AC 149 ms
19,108 KB
testcase_20 AC 77 ms
18,832 KB
testcase_21 AC 78 ms
18,848 KB
testcase_22 AC 76 ms
18,840 KB
testcase_23 AC 117 ms
18,884 KB
testcase_24 AC 141 ms
18,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,X,Y=map(int, input().split())
A=list(map(int, input().split()))
D=[]
e=(max(A)-2)//K+1
for i in A:
    d=(i-2)//K+1
    D.append(d)
    
a=Y//X
D=sorted(D)
if X>=Y:
    print(max(D)*Y)
    exit()
if -1-a>=-1*N:
    n=D[-1-a]
    ans=0
    ans+=n*Y
    for i in D:
        ans+=(max(0,i-n))*X 
    print(ans)
    
else:
    print(sum(D)*X)
0