結果

問題 No.1071 ベホマラー
ユーザー s_shoheis_shohei
提出日時 2020-08-02 17:56:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 98,320 KB
最終ジャッジ日時 2023-09-26 08:41:44
合計ジャッジ時間 5,560 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,348 KB
testcase_01 AC 69 ms
71,392 KB
testcase_02 AC 69 ms
71,432 KB
testcase_03 AC 70 ms
71,612 KB
testcase_04 AC 71 ms
71,312 KB
testcase_05 AC 71 ms
71,428 KB
testcase_06 AC 71 ms
71,488 KB
testcase_07 AC 70 ms
71,376 KB
testcase_08 AC 71 ms
71,244 KB
testcase_09 AC 71 ms
71,348 KB
testcase_10 AC 111 ms
95,208 KB
testcase_11 AC 108 ms
93,128 KB
testcase_12 AC 97 ms
86,584 KB
testcase_13 AC 106 ms
91,204 KB
testcase_14 AC 116 ms
95,380 KB
testcase_15 AC 120 ms
98,320 KB
testcase_16 AC 119 ms
98,236 KB
testcase_17 AC 117 ms
98,148 KB
testcase_18 AC 118 ms
98,288 KB
testcase_19 AC 117 ms
98,264 KB
testcase_20 AC 101 ms
97,868 KB
testcase_21 AC 101 ms
97,780 KB
testcase_22 AC 100 ms
97,712 KB
testcase_23 AC 102 ms
97,780 KB
testcase_24 AC 108 ms
98,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,x,y = map(int, input().split())
a = list(map(int, input().split()))
newa=[]

def ceil(a,b):
    return ((a - 1) // b) + 1

for tmp in a:
    if tmp==1:
        continue
    newa.append(ceil(tmp-1,k))

newa.sort()

all_cnt=0
single_cnt=0
nokori=len(newa)

for num in newa:
    need = num - all_cnt
    if nokori*x >= y:
        all_cnt+=need
        nokori-=1
    else:
        single_cnt+=need

print(all_cnt*y + single_cnt*x)
0