結果

問題 No.1071 ベホマラー
ユーザー qumazakiqumazaki
提出日時 2020-06-06 01:49:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 92,712 KB
最終ジャッジ日時 2023-08-22 21:22:34
合計ジャッジ時間 5,176 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,064 KB
testcase_01 AC 75 ms
71,188 KB
testcase_02 AC 75 ms
70,872 KB
testcase_03 AC 75 ms
71,224 KB
testcase_04 AC 76 ms
71,248 KB
testcase_05 AC 76 ms
71,268 KB
testcase_06 AC 75 ms
71,428 KB
testcase_07 AC 75 ms
71,164 KB
testcase_08 AC 76 ms
71,148 KB
testcase_09 AC 76 ms
71,248 KB
testcase_10 AC 257 ms
89,004 KB
testcase_11 AC 105 ms
87,648 KB
testcase_12 AC 98 ms
82,876 KB
testcase_13 AC 115 ms
87,140 KB
testcase_14 AC 111 ms
89,824 KB
testcase_15 AC 115 ms
91,068 KB
testcase_16 AC 112 ms
91,224 KB
testcase_17 AC 114 ms
92,248 KB
testcase_18 AC 115 ms
92,712 KB
testcase_19 AC 115 ms
92,104 KB
testcase_20 AC 102 ms
92,492 KB
testcase_21 AC 99 ms
90,964 KB
testcase_22 AC 100 ms
92,384 KB
testcase_23 AC 99 ms
92,188 KB
testcase_24 AC 106 ms
91,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,x,y = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)

# ベホイミのほうが効率が良い最大人数
upper = y//x
if(upper < n):
    bhm = 1 + (a[upper]-1-1)//k
else:
    upper = n
    bhm = 0

ans = y*bhm
for i in a[:upper]:
    remain = i - k*bhm
    if(remain<=0):
        continue
    ans += (1+(remain-1-1)//k) * x

print(ans)
0