結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 47 ms
57,472 KB
testcase_02 AC 47 ms
57,344 KB
testcase_03 AC 43 ms
51,712 KB
testcase_04 AC 49 ms
58,240 KB
testcase_05 AC 47 ms
57,856 KB
testcase_06 AC 47 ms
58,752 KB
testcase_07 AC 49 ms
59,008 KB
testcase_08 AC 50 ms
59,136 KB
testcase_09 AC 42 ms
51,712 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**20

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