結果

問題 No.1071 ベホマラー
ユーザー 👑 timitimi
提出日時 2020-10-07 17:24:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 342 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 19,168 KB
最終ジャッジ日時 2023-09-27 09:19:54
合計ジャッジ時間 4,445 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 15 ms
7,888 KB
testcase_02 AC 15 ms
8,160 KB
testcase_03 AC 15 ms
7,872 KB
testcase_04 AC 15 ms
7,828 KB
testcase_05 AC 15 ms
7,828 KB
testcase_06 AC 15 ms
7,836 KB
testcase_07 AC 16 ms
7,828 KB
testcase_08 AC 16 ms
7,812 KB
testcase_09 WA -
testcase_10 AC 117 ms
17,248 KB
testcase_11 AC 80 ms
16,672 KB
testcase_12 AC 80 ms
13,716 KB
testcase_13 AC 106 ms
15,808 KB
testcase_14 AC 124 ms
17,500 KB
testcase_15 AC 141 ms
19,168 KB
testcase_16 AC 139 ms
19,084 KB
testcase_17 AC 147 ms
19,076 KB
testcase_18 AC 147 ms
18,996 KB
testcase_19 AC 141 ms
19,092 KB
testcase_20 AC 74 ms
18,832 KB
testcase_21 AC 76 ms
18,892 KB
testcase_22 AC 75 ms
18,836 KB
testcase_23 WA -
testcase_24 AC 139 ms
18,816 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>=-N+1:
    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