結果
| 問題 | No.1071 ベホマラー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-05 22:01:58 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 177 ms / 2,000 ms |
| + 913µs | |
| コード長 | 491 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,592 KB |
| 実行使用メモリ | 19,604 KB |
| 最終ジャッジ日時 | 2026-10-30 01:28:09 |
| 合計ジャッジ時間 | 4,102 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 22 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, k, x, y = map(int, readline().split())
a = list(map(int, readline().split()))
a.sort()
ans = 0
now = 1
for i, aa in enumerate(a):
if aa - now <= 0:
continue
m = (aa - now) // k
ans += min(m * y, m * x * (n - i))
now += m * k
if (aa - now) % k != 0:
ans += min(x * (n - i), y)
now += k
print(ans)