結果

問題 No.1071 ベホマラー
ユーザー RiburaRibura
提出日時 2020-06-05 22:01:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 20,100 KB
最終ジャッジ日時 2024-05-09 21:11:21
合計ジャッジ時間 4,307 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 32 ms
10,496 KB
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 31 ms
10,624 KB
testcase_04 AC 29 ms
10,624 KB
testcase_05 AC 29 ms
10,496 KB
testcase_06 AC 30 ms
10,624 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 29 ms
10,624 KB
testcase_09 AC 29 ms
10,624 KB
testcase_10 AC 196 ms
18,504 KB
testcase_11 AC 230 ms
18,260 KB
testcase_12 AC 136 ms
15,732 KB
testcase_13 AC 217 ms
17,380 KB
testcase_14 AC 213 ms
18,752 KB
testcase_15 AC 291 ms
19,972 KB
testcase_16 AC 241 ms
20,096 KB
testcase_17 AC 288 ms
19,968 KB
testcase_18 AC 229 ms
20,100 KB
testcase_19 AC 234 ms
20,096 KB
testcase_20 AC 83 ms
20,100 KB
testcase_21 AC 83 ms
19,968 KB
testcase_22 AC 82 ms
20,100 KB
testcase_23 AC 80 ms
19,968 KB
testcase_24 AC 214 ms
20,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k, x, y = map(int, readline().split())
a = list(map(int, readline().split()))
a.sort()
ans = 0
now = 1
for i, aa in enumerate(a):
    if aa - now <= 0:
        continue
    m = (aa - now) // k
    ans += min(m * y, m * x * (n - i))
    now += m * k
    if (aa - now) % k != 0:
        ans += min(x * (n - i), y)
        now += k
print(ans)
0