結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 28 ms
10,880 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 27 ms
10,752 KB
testcase_08 AC 28 ms
10,880 KB
testcase_09 AC 27 ms
10,752 KB
testcase_10 AC 215 ms
19,916 KB
testcase_11 AC 205 ms
19,508 KB
testcase_12 AC 150 ms
16,476 KB
testcase_13 AC 199 ms
18,480 KB
testcase_14 AC 228 ms
20,228 KB
testcase_15 AC 261 ms
21,808 KB
testcase_16 AC 269 ms
21,808 KB
testcase_17 AC 252 ms
21,812 KB
testcase_18 AC 247 ms
21,936 KB
testcase_19 AC 245 ms
21,804 KB
testcase_20 AC 129 ms
21,736 KB
testcase_21 AC 129 ms
21,656 KB
testcase_22 AC 124 ms
21,776 KB
testcase_23 AC 125 ms
21,656 KB
testcase_24 AC 239 ms
21,936 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