結果

問題 No.1071 ベホマラー
ユーザー trineutrontrineutron
提出日時 2020-06-05 21:37:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,772 KB
最終ジャッジ日時 2024-05-09 20:19:52
合計ジャッジ時間 3,025 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,624 KB
testcase_01 AC 25 ms
10,624 KB
testcase_02 AC 23 ms
10,624 KB
testcase_03 AC 23 ms
10,624 KB
testcase_04 AC 24 ms
10,624 KB
testcase_05 AC 23 ms
10,752 KB
testcase_06 AC 24 ms
10,752 KB
testcase_07 AC 24 ms
10,752 KB
testcase_08 AC 24 ms
10,752 KB
testcase_09 AC 24 ms
10,624 KB
testcase_10 AC 84 ms
19,912 KB
testcase_11 AC 84 ms
19,504 KB
testcase_12 AC 64 ms
16,540 KB
testcase_13 AC 92 ms
18,344 KB
testcase_14 AC 92 ms
20,112 KB
testcase_15 AC 105 ms
21,500 KB
testcase_16 AC 102 ms
21,624 KB
testcase_17 AC 123 ms
21,504 KB
testcase_18 AC 133 ms
21,520 KB
testcase_19 AC 113 ms
21,624 KB
testcase_20 AC 106 ms
21,644 KB
testcase_21 AC 82 ms
21,520 KB
testcase_22 AC 106 ms
21,516 KB
testcase_23 AC 105 ms
21,772 KB
testcase_24 AC 93 ms
21,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, x, y = map(int, input().split())
a = sorted(list(map(int, input().split())))
for i in range(n):
    a[i] = (a[i] + k - 2) // k
r = y // x
if r >= n:
    t = 0
else:
    t = a[-r-1]
ans = y * t
for i in range(max(0, n - r), n):
    ans += x * (a[i] - t)
print(ans)
0