結果
| 問題 |
No.1071 ベホマラー
|
| コンテスト | |
| ユーザー |
totori_nyaa
|
| 提出日時 | 2020-06-05 22:21:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 334 ms / 2,000 ms |
| コード長 | 456 bytes |
| コンパイル時間 | 94 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 21,976 KB |
| 最終ジャッジ日時 | 2024-12-17 16:03:23 |
| 合計ジャッジ時間 | 5,646 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
n,k,x,y = map(int,input().split())
a = [int(i) for i in input().split()]
ans = 0
for i in range(n):
ans += ((a[i]-1+k-1)//k)*x
a = sorted(a)
for i in range(n):
a[i] = a[i]-1
sum = []
for i in range(n+1):
sum.append(0)
for i in range(n):
sum[n-i-1] = sum[n-i] + ((a[n-i-1]+k-1)//k)*x
for i in range(n):
cnt = a[i]//k
if(a[i]%k!=0): cnt += 1
ret = sum[i+1] + cnt*y
ret -= x*cnt*(n-i-1)
if(ans > ret): ans=ret
print(ans)
totori_nyaa