結果

問題 No.1071 ベホマラー
ユーザー tktk_snsntktk_snsn
提出日時 2020-06-05 21:28:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 18,992 KB
最終ジャッジ日時 2023-08-22 14:16:22
合計ジャッジ時間 3,939 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,768 KB
testcase_01 AC 15 ms
7,876 KB
testcase_02 AC 15 ms
7,780 KB
testcase_03 AC 15 ms
7,764 KB
testcase_04 AC 15 ms
7,904 KB
testcase_05 AC 15 ms
7,860 KB
testcase_06 AC 15 ms
7,936 KB
testcase_07 AC 15 ms
7,772 KB
testcase_08 AC 15 ms
7,900 KB
testcase_09 AC 15 ms
7,956 KB
testcase_10 AC 176 ms
17,192 KB
testcase_11 AC 175 ms
16,784 KB
testcase_12 AC 120 ms
13,632 KB
testcase_13 AC 155 ms
15,852 KB
testcase_14 AC 193 ms
17,396 KB
testcase_15 AC 217 ms
18,992 KB
testcase_16 AC 216 ms
18,884 KB
testcase_17 AC 213 ms
18,908 KB
testcase_18 AC 215 ms
18,880 KB
testcase_19 AC 221 ms
18,776 KB
testcase_20 AC 99 ms
18,852 KB
testcase_21 AC 99 ms
18,912 KB
testcase_22 AC 101 ms
18,808 KB
testcase_23 AC 100 ms
18,900 KB
testcase_24 AC 203 ms
18,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0
cnt = 0
for i, a in enumerate(A):
    a -= 1
    a = max(0, a - cnt * K)
    if a == 0:
        continue
    spell = (a + K - 1) // K
    ans += min(Y, (N - i) * X) * spell
    cnt += spell

print(ans)
0