結果

問題 No.1071 ベホマラー
ユーザー MineMine
提出日時 2020-09-01 14:16:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,004 KB
実行使用メモリ 19,280 KB
最終ジャッジ日時 2023-08-12 02:12:44
合計ジャッジ時間 3,155 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,824 KB
testcase_01 AC 15 ms
7,976 KB
testcase_02 AC 15 ms
8,140 KB
testcase_03 AC 15 ms
7,796 KB
testcase_04 AC 16 ms
7,824 KB
testcase_05 AC 15 ms
7,892 KB
testcase_06 AC 15 ms
7,992 KB
testcase_07 AC 15 ms
7,824 KB
testcase_08 AC 15 ms
7,824 KB
testcase_09 AC 15 ms
7,908 KB
testcase_10 AC 81 ms
17,208 KB
testcase_11 AC 80 ms
16,776 KB
testcase_12 AC 59 ms
13,716 KB
testcase_13 AC 77 ms
15,928 KB
testcase_14 AC 87 ms
17,492 KB
testcase_15 AC 95 ms
19,192 KB
testcase_16 AC 95 ms
19,116 KB
testcase_17 AC 105 ms
19,280 KB
testcase_18 AC 107 ms
19,224 KB
testcase_19 AC 103 ms
19,088 KB
testcase_20 AC 79 ms
19,016 KB
testcase_21 AC 78 ms
18,920 KB
testcase_22 AC 79 ms
18,952 KB
testcase_23 AC 84 ms
18,876 KB
testcase_24 AC 92 ms
19,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

a.sort(reverse = True)

if x > y:
    print(a[0]*y)
    exit()

k = y//x

if k < n:
    ans = y*a[k] + x*sum([a[i] - a[k] for i in range(k)])
    print(ans)
else:   
    print(sum(a)*x)
0