QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 32 MB 總分: 10

#10661. 蘑菇 [B]

统计

Bytean 森林下了一场大雨。热衷于采蘑菇的 Byteman 决定去森林里碰碰运气。

Byteman 知道一条穿过森林的优美小径,小径上有若干个长满蘑菇的林中空地。小径上每相邻两个空地之间的距离相等——Byteman 走过任意一对相邻空地需要 15 分钟。到达一个空地后,Byteman 会像任何一个有自尊的采蘑菇者一样,瞬间采完该空地上的所有蘑菇。众所周知,蘑菇……生长迅速,被采摘后只需半小时就能重新长出来。

已知各个空地上生长的蘑菇数量以及 Byteman 步行的时间,假设他选择一条能使收获最大化的路线,请计算他总共能采到多少蘑菇。Byteman 可以在路径上的任意一点结束他的行程。

输入格式

标准输入的第一行包含两个整数 $n$ 和 $t$ ($1 \le n, t \le 1\,000\,000$),分别表示路径上的空地数量和 Byteman 步行的时间(以 15 分钟为一个单位)。第二行包含一个由 $n$ 个整数组成的序列 $a_i$ ($1 \le a_i \le 1\,000\,000$),表示路径上各个连续空地中的蘑菇数量。Byteman 从第一个空地开始他的行程。我们假设 Byteman 可以在采蘑菇的第 0 个单位时间之前以及第 $i$ 个单位时间之后采摘蘑菇。

输出格式

程序应在标准输出的第一行输出一个整数:Byteman 在行程中能采到的蘑菇最大数量。

样例

输入 1

5 4
3 4 3 5 1

输出 1

18

说明

在 Byteman 的最优路线中,他花费了 60 分钟,共采摘了 18 个蘑菇:在第 0 分钟采摘 3 个,15 分钟后采摘 4 个,30 分钟后采摘 3 个,45 分钟后采摘 5 个,最后在 60 分钟后采摘 3 个。

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.