結果

問題 No.1071 ベホマラー
ユーザー SalmonizeSalmonize
提出日時 2020-06-05 21:35:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,836 KB
最終ジャッジ日時 2024-05-09 20:17:47
合計ジャッジ時間 3,060 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,624 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 29 ms
10,624 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 30 ms
10,624 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 29 ms
10,624 KB
testcase_08 AC 29 ms
10,624 KB
testcase_09 AC 29 ms
10,624 KB
testcase_10 AC 80 ms
19,820 KB
testcase_11 AC 80 ms
19,512 KB
testcase_12 AC 62 ms
16,448 KB
testcase_13 AC 98 ms
18,504 KB
testcase_14 AC 85 ms
20,000 KB
testcase_15 AC 90 ms
21,836 KB
testcase_16 AC 90 ms
21,708 KB
testcase_17 AC 125 ms
21,708 KB
testcase_18 AC 136 ms
21,712 KB
testcase_19 AC 116 ms
21,712 KB
testcase_20 AC 117 ms
21,512 KB
testcase_21 AC 73 ms
21,424 KB
testcase_22 AC 118 ms
21,680 KB
testcase_23 AC 107 ms
21,552 KB
testcase_24 AC 91 ms
21,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

readline = sys.stdin.readline

ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))


def solve():
    n, k, x, y = nm()
    a = [0] + [j-1 for j in nl()]
    a.sort()
    f = min(y // x, n)
    ans = 0
    c = a[-f-1]
    g = ((c - 1) // k + 1)
    ans = y * g + x * sum(max(j - g * k - 1, -1)//k + 1 for j in a[-f:]) * (f > 0)
    print(ans)
    return

solve()
0