結果
| 問題 | No.1071 ベホマラー |
| コンテスト | |
| ユーザー |
totori_nyaa
|
| 提出日時 | 2020-06-05 22:21:25 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 247 ms / 2,000 ms |
| + 69µs | |
| コード長 | 456 bytes |
| 記録 | |
| コンパイル時間 | 50 ms |
| コンパイル使用メモリ | 14,592 KB |
| 実行使用メモリ | 22,336 KB |
| 最終ジャッジ日時 | 2026-10-19 17:54:52 |
| 合計ジャッジ時間 | 5,601 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 21 |
ソースコード
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