結果

問題 No.1071 ベホマラー
ユーザー realDivineJKrealDivineJK
提出日時 2020-06-05 22:31:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 19,244 KB
最終ジャッジ日時 2023-08-22 16:19:54
合計ジャッジ時間 4,143 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,932 KB
testcase_01 AC 15 ms
7,800 KB
testcase_02 AC 16 ms
7,876 KB
testcase_03 AC 15 ms
7,784 KB
testcase_04 AC 15 ms
7,748 KB
testcase_05 AC 16 ms
7,760 KB
testcase_06 AC 16 ms
7,880 KB
testcase_07 AC 16 ms
7,912 KB
testcase_08 AC 16 ms
7,856 KB
testcase_09 AC 15 ms
7,764 KB
testcase_10 AC 169 ms
17,052 KB
testcase_11 AC 170 ms
16,668 KB
testcase_12 AC 114 ms
13,860 KB
testcase_13 AC 114 ms
15,960 KB
testcase_14 AC 179 ms
17,560 KB
testcase_15 AC 206 ms
19,236 KB
testcase_16 AC 201 ms
19,120 KB
testcase_17 AC 153 ms
19,204 KB
testcase_18 AC 139 ms
19,068 KB
testcase_19 AC 174 ms
19,200 KB
testcase_20 AC 108 ms
18,824 KB
testcase_21 AC 159 ms
18,856 KB
testcase_22 AC 107 ms
18,848 KB
testcase_23 AC 100 ms
18,808 KB
testcase_24 AC 174 ms
19,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K, X, Y = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] -= 1
A.sort()
pos = 0
S = 0
HP = 0
while (N - pos) * X >= Y:
    S += ((A[pos] - HP) // K + ((A[pos] - HP) % K != 0)) * Y
    HP += ((A[pos] - HP) // K + ((A[pos] - HP) % K != 0)) * K
    pos += 1
    if pos == N:
        break
for j in range(pos, N):
    S += ((A[j] - HP) // K + ((A[j] - HP) % K != 0)) * X
print(S)
0