QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#3945. 公交车票

Estadísticas

该死!你当地 Bus-Go-On 系统 (BGO) 的定期票过期了。起初你打算今天就买一张新票,但你突然意识到,如果现在买,新票会在你假期开始前几天就过期,这样你仍需为剩下的几次行程单独付费。或许现在按单次行程付费会更便宜,从而让下一张定期票能覆盖未来更多的行程?

Pixabay License, by TuendeBede via Pixabay

输入格式

第一行包含四个正整数 $s, p, m$ 和 $n$。$s$ ($1 \le s \le 10^9$) 是 BGO 单次行程的价格,$p$ ($1 \le p \le 10^9$) 是定期票的价格,$m$ ($1 \le m \le 10^9$) 是定期票覆盖的天数,$n$ ($1 \le n \le 10^6$) 是你计划在未来进行的行程次数(直到你不再需要进行任何行程为止)。

第二行包含 $n$ 个非负整数,按非递减顺序排列 $t_1, t_2, \dots, t_n$,其中 $t_i$ ($0 \le t_i \le 10^9$) 是你进行第 $i$ 次 BGO 行程所需的天数。

输出格式

完成所有行程的最小可能花费。

样例

输入 1

10 25 30 6
0 1 2 30 30 32

输出 1

45

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.