結果

問題 No.1071 ベホマラー
ユーザー realDivineJKrealDivineJK
提出日時 2020-06-05 22:31:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,848 KB
最終ジャッジ日時 2024-05-09 22:06:46
合計ジャッジ時間 4,623 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 32 ms
10,752 KB
testcase_08 AC 34 ms
10,880 KB
testcase_09 AC 32 ms
10,624 KB
testcase_10 AC 219 ms
19,828 KB
testcase_11 AC 220 ms
19,400 KB
testcase_12 AC 151 ms
16,572 KB
testcase_13 AC 159 ms
18,504 KB
testcase_14 AC 223 ms
20,252 KB
testcase_15 AC 257 ms
21,836 KB
testcase_16 AC 273 ms
21,708 KB
testcase_17 AC 216 ms
21,848 KB
testcase_18 AC 194 ms
21,716 KB
testcase_19 AC 228 ms
21,840 KB
testcase_20 AC 144 ms
21,544 KB
testcase_21 AC 203 ms
21,672 KB
testcase_22 AC 148 ms
21,676 KB
testcase_23 AC 132 ms
21,676 KB
testcase_24 AC 211 ms
21,716 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