結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 27 ms
10,624 KB
testcase_04 AC 28 ms
10,752 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 29 ms
10,752 KB
testcase_09 AC 29 ms
10,752 KB
testcase_10 AC 198 ms
19,784 KB
testcase_11 AC 199 ms
19,512 KB
testcase_12 AC 136 ms
16,544 KB
testcase_13 AC 162 ms
18,472 KB
testcase_14 AC 206 ms
20,244 KB
testcase_15 AC 241 ms
21,636 KB
testcase_16 AC 239 ms
21,500 KB
testcase_17 AC 221 ms
21,508 KB
testcase_18 AC 202 ms
21,556 KB
testcase_19 AC 219 ms
21,632 KB
testcase_20 AC 169 ms
21,652 KB
testcase_21 AC 175 ms
21,524 KB
testcase_22 AC 168 ms
21,520 KB
testcase_23 AC 153 ms
21,648 KB
testcase_24 AC 206 ms
21,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, K, X, Y = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

ans = 0
alr = 1
for i, a in enumerate(A):
    a -= alr
    a = max(a, 0)
    if (N-i)*X < Y:
        ans += ((a+K-1)//K) * X
    else:
        alr += ((a+K-1)//K) * K
        ans += ((a+K-1)//K) * Y
print(ans)
0