結果

問題 No.1071 ベホマラー
ユーザー hir355hir355
提出日時 2020-06-05 21:28:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 92,856 KB
最終ジャッジ日時 2023-08-22 14:16:18
合計ジャッジ時間 3,885 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,044 KB
testcase_01 AC 69 ms
71,216 KB
testcase_02 AC 70 ms
71,204 KB
testcase_03 AC 71 ms
71,408 KB
testcase_04 AC 70 ms
71,228 KB
testcase_05 AC 70 ms
71,320 KB
testcase_06 AC 69 ms
71,272 KB
testcase_07 AC 70 ms
71,164 KB
testcase_08 AC 69 ms
71,072 KB
testcase_09 AC 70 ms
71,156 KB
testcase_10 AC 105 ms
90,260 KB
testcase_11 AC 104 ms
89,024 KB
testcase_12 AC 96 ms
84,276 KB
testcase_13 AC 104 ms
87,332 KB
testcase_14 AC 108 ms
90,520 KB
testcase_15 AC 115 ms
92,856 KB
testcase_16 AC 113 ms
92,708 KB
testcase_17 AC 113 ms
92,736 KB
testcase_18 AC 113 ms
92,856 KB
testcase_19 AC 113 ms
92,732 KB
testcase_20 AC 96 ms
92,368 KB
testcase_21 AC 96 ms
92,304 KB
testcase_22 AC 98 ms
92,564 KB
testcase_23 AC 98 ms
92,544 KB
testcase_24 AC 106 ms
92,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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