結果

問題 No.1071 ベホマラー
ユーザー maguchi_p_qmaguchi_p_q
提出日時 2020-06-12 19:36:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 1,100 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 19,332 KB
最終ジャッジ日時 2023-09-06 09:30:32
合計ジャッジ時間 4,343 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,052 KB
testcase_01 AC 17 ms
7,984 KB
testcase_02 AC 17 ms
8,028 KB
testcase_03 AC 17 ms
7,920 KB
testcase_04 AC 16 ms
8,016 KB
testcase_05 AC 16 ms
7,996 KB
testcase_06 AC 17 ms
7,972 KB
testcase_07 AC 17 ms
7,912 KB
testcase_08 AC 17 ms
7,980 KB
testcase_09 AC 16 ms
8,024 KB
testcase_10 AC 129 ms
17,208 KB
testcase_11 AC 125 ms
16,800 KB
testcase_12 AC 88 ms
13,852 KB
testcase_13 AC 78 ms
15,888 KB
testcase_14 AC 134 ms
17,612 KB
testcase_15 AC 154 ms
19,272 KB
testcase_16 AC 159 ms
19,332 KB
testcase_17 AC 102 ms
19,260 KB
testcase_18 AC 88 ms
19,288 KB
testcase_19 AC 125 ms
19,204 KB
testcase_20 AC 63 ms
18,984 KB
testcase_21 AC 81 ms
19,008 KB
testcase_22 AC 64 ms
18,960 KB
testcase_23 AC 82 ms
19,024 KB
testcase_24 AC 128 ms
19,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import ceil

N,K,X,Y = [int(zz) for zz in input().split()]
A = [ceil((int(zz)-1)/K) for zz in input().split()]

A.sort()
tmp = 0
ans = 0
for i in range(N):
    if A[i]-tmp > 0:
        if X*(N-i) > Y:
            ans += Y*(A[i]-tmp)
        else:
            break
        tmp = A[i]
    A[i] = 0
if sum(A) > 0:
    ans += (sum(A)-(N-i)*tmp)*X
print(ans)
0