結果

問題 No.1071 ベホマラー
ユーザー kohei2019kohei2019
提出日時 2020-12-22 03:26:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 20,896 KB
最終ジャッジ日時 2023-10-21 12:23:38
合計ジャッジ時間 4,928 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,176 KB
testcase_01 AC 30 ms
10,176 KB
testcase_02 AC 30 ms
10,176 KB
testcase_03 AC 31 ms
10,176 KB
testcase_04 AC 32 ms
10,176 KB
testcase_05 AC 32 ms
10,176 KB
testcase_06 AC 30 ms
10,176 KB
testcase_07 AC 31 ms
10,180 KB
testcase_08 AC 30 ms
10,184 KB
testcase_09 AC 30 ms
10,176 KB
testcase_10 AC 147 ms
19,144 KB
testcase_11 AC 143 ms
18,740 KB
testcase_12 AC 102 ms
15,752 KB
testcase_13 AC 129 ms
17,836 KB
testcase_14 AC 156 ms
19,472 KB
testcase_15 AC 173 ms
20,896 KB
testcase_16 AC 172 ms
20,896 KB
testcase_17 AC 167 ms
20,896 KB
testcase_18 AC 169 ms
20,896 KB
testcase_19 AC 172 ms
20,896 KB
testcase_20 AC 132 ms
20,896 KB
testcase_21 AC 94 ms
20,896 KB
testcase_22 AC 132 ms
20,896 KB
testcase_23 AC 97 ms
20,896 KB
testcase_24 AC 165 ms
20,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,X,Y = map(int,input().split())
lsA = list(map(int,input().split()))
lsA1 = [-(-(lsA[i]-1)//K) for i in range(N)]#必要回数
#ベホマラーの方がお得な回復人数
B = -(-Y//X)
lsA1.sort()
d = 0
ans = 0
for i in range(N):
    if lsA1[i]-d == 0:
        continue
    rm = N-i
    if rm >= B:
        ans += (lsA1[i]-d)*Y
        d = lsA1[i]
    else:
        ans += (lsA1[i]-d)*X
print(ans)
0