結果

問題 No.1071 ベホマラー
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-27 23:46:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 91,160 KB
最終ジャッジ日時 2024-04-24 09:27:48
合計ジャッジ時間 4,080 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,224 KB
testcase_01 AC 38 ms
52,480 KB
testcase_02 AC 38 ms
52,224 KB
testcase_03 AC 37 ms
52,096 KB
testcase_04 AC 38 ms
52,480 KB
testcase_05 AC 42 ms
57,728 KB
testcase_06 AC 42 ms
58,112 KB
testcase_07 AC 47 ms
58,368 KB
testcase_08 AC 43 ms
58,368 KB
testcase_09 AC 39 ms
52,480 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,x,y = map(int,input().split())
A = list(map(int,input().split()))
l = 0
r = 10**15

def calc(m):
    count = 0
    for a in A:
        if a-1 <= m*k:
            continue
        count += (a-1-m*k+(k-1))//k*x
    return count + y*m


while r > l+2:
    c1 = (l*2+r)//3
    c2 = (l+r*2)//3
    if calc(c1) <= calc(c2):
        r = c2
    else:
        l = c1

ans = 10**10
for i in range(l,r+2):
    ans = min(ans,calc(i))
print(ans)
0