結果

問題 No.1071 ベホマラー
ユーザー FromBooskaFromBooska
提出日時 2023-08-11 10:59:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 93,568 KB
最終ジャッジ日時 2024-04-29 03:28:54
合計ジャッジ時間 2,717 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,584 KB
testcase_01 AC 37 ms
51,584 KB
testcase_02 AC 35 ms
51,584 KB
testcase_03 AC 39 ms
51,940 KB
testcase_04 AC 37 ms
52,096 KB
testcase_05 AC 37 ms
52,608 KB
testcase_06 AC 37 ms
51,840 KB
testcase_07 AC 37 ms
51,968 KB
testcase_08 AC 35 ms
51,824 KB
testcase_09 AC 37 ms
51,968 KB
testcase_10 AC 81 ms
87,296 KB
testcase_11 AC 76 ms
86,144 KB
testcase_12 AC 62 ms
78,080 KB
testcase_13 AC 75 ms
83,840 KB
testcase_14 AC 79 ms
89,512 KB
testcase_15 AC 84 ms
92,416 KB
testcase_16 AC 88 ms
92,416 KB
testcase_17 AC 87 ms
93,568 KB
testcase_18 AC 84 ms
93,184 KB
testcase_19 AC 85 ms
93,440 KB
testcase_20 AC 70 ms
91,904 KB
testcase_21 AC 70 ms
91,776 KB
testcase_22 AC 66 ms
92,032 KB
testcase_23 AC 67 ms
92,032 KB
testcase_24 AC 76 ms
93,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 想定解法でやってみる

N, K, X, Y = map(int, input().split())
A = list(map(int, input().split()))

AK = [0]
for a in A:
    calc = (a-1+K-1)//K
    AK.append(calc)
AK.sort()
    
#print(AK)

if sum(AK) == 0:
    print(0)
    exit()

ans = 0
y = 0
for i in range(N):
    remaining = N-i
    if X*remaining > Y:
        y = i+1
    else:
        ans += (AK[i+1]-AK[y])*X
ans += AK[y]*Y
print(ans)
0