結果

問題 No.1071 ベホマラー
ユーザー trineutrontrineutron
提出日時 2020-06-05 21:37:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 10,600 KB
実行使用メモリ 19,180 KB
最終ジャッジ日時 2023-08-22 14:36:21
合計ジャッジ時間 2,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,880 KB
testcase_01 AC 15 ms
7,868 KB
testcase_02 AC 15 ms
7,836 KB
testcase_03 AC 15 ms
7,884 KB
testcase_04 AC 15 ms
7,700 KB
testcase_05 AC 15 ms
7,784 KB
testcase_06 AC 15 ms
7,832 KB
testcase_07 AC 15 ms
7,748 KB
testcase_08 AC 16 ms
7,756 KB
testcase_09 AC 15 ms
7,732 KB
testcase_10 AC 80 ms
17,008 KB
testcase_11 AC 80 ms
16,740 KB
testcase_12 AC 58 ms
13,640 KB
testcase_13 AC 84 ms
15,704 KB
testcase_14 AC 85 ms
17,472 KB
testcase_15 AC 95 ms
19,076 KB
testcase_16 AC 93 ms
19,160 KB
testcase_17 AC 118 ms
19,056 KB
testcase_18 AC 120 ms
19,132 KB
testcase_19 AC 113 ms
19,000 KB
testcase_20 AC 96 ms
18,788 KB
testcase_21 AC 74 ms
18,760 KB
testcase_22 AC 98 ms
18,800 KB
testcase_23 AC 93 ms
18,848 KB
testcase_24 AC 87 ms
19,180 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