結果

問題 No.1071 ベホマラー
ユーザー SalmonizeSalmonize
提出日時 2020-06-05 21:35:52
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 19,236 KB
最終ジャッジ日時 2023-08-22 14:33:59
合計ジャッジ時間 2,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,840 KB
testcase_01 AC 15 ms
7,772 KB
testcase_02 AC 15 ms
7,948 KB
testcase_03 AC 15 ms
7,916 KB
testcase_04 AC 14 ms
7,864 KB
testcase_05 AC 14 ms
7,864 KB
testcase_06 AC 15 ms
7,892 KB
testcase_07 AC 15 ms
7,988 KB
testcase_08 AC 15 ms
7,816 KB
testcase_09 AC 15 ms
7,864 KB
testcase_10 AC 58 ms
17,288 KB
testcase_11 AC 59 ms
16,820 KB
testcase_12 AC 44 ms
13,892 KB
testcase_13 AC 70 ms
16,096 KB
testcase_14 AC 63 ms
17,616 KB
testcase_15 AC 69 ms
19,168 KB
testcase_16 AC 69 ms
19,236 KB
testcase_17 AC 93 ms
19,200 KB
testcase_18 AC 101 ms
19,184 KB
testcase_19 AC 86 ms
19,180 KB
testcase_20 AC 83 ms
19,180 KB
testcase_21 AC 50 ms
18,988 KB
testcase_22 AC 84 ms
19,120 KB
testcase_23 AC 79 ms
18,988 KB
testcase_24 AC 67 ms
19,136 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