結果

問題 No.1071 ベホマラー
ユーザー 👑 rin204rin204
提出日時 2020-08-13 11:57:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,820 KB
最終ジャッジ日時 2024-04-18 01:25:15
合計ジャッジ時間 3,291 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 29 ms
10,624 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 29 ms
10,624 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 28 ms
10,624 KB
testcase_10 AC 90 ms
19,928 KB
testcase_11 AC 87 ms
19,504 KB
testcase_12 AC 67 ms
16,552 KB
testcase_13 AC 97 ms
18,352 KB
testcase_14 AC 95 ms
20,224 KB
testcase_15 AC 102 ms
21,688 KB
testcase_16 AC 103 ms
21,504 KB
testcase_17 AC 128 ms
21,692 KB
testcase_18 AC 136 ms
21,820 KB
testcase_19 AC 119 ms
21,812 KB
testcase_20 AC 110 ms
21,528 KB
testcase_21 AC 81 ms
21,528 KB
testcase_22 AC 113 ms
21,784 KB
testcase_23 AC 105 ms
21,784 KB
testcase_24 AC 98 ms
21,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, x, y = map(int, input().split())
alst = list(map(int, input().split()))
cnt = [(a - 2) // k + 1 for a in alst]
cnt.sort(reverse = True)
x_s = min(y // x - 1, n - 1)
ans = 0
y_cnt = 0
if x_s != n - 1:
    y_cnt = cnt[x_s + 1]
    ans = y * y_cnt
for i in range(x_s + 1):
    ans += x * (cnt[i] - y_cnt)
print(ans)
0