P9889 [ICPC2018 Qingdao R] Plants vs. Zombies 题解 二分+贪心

[ICPC2018 Qingdao R] Plants vs. Zombies

传送门

题面翻译

给定 n n n 个植物和 m m m 的步数限制,每个植物在位置 1 … n 1\dots n 1n 上。你初始时在位置 0 0 0,每次可以移动到相邻的位置上。

每次设你走完一步后到达的位置是 i i i,则会使得这个位置的植物的高度增加 a i a_i ai。设 d i d_i di 为走完 m m m 步后位置 i i i 的植物高度,求出一个最优的走法使得 min ⁡ 1 ≤ i ≤ n d i \min\limits_{1 \le i \le n} d_i 1inmindi 最大。

2 ≤ n ≤ 1 0 5 2\leq n\leq 10 ^ 5 2n105 0 ≤ m ≤ 1 0 12 0\leq m\leq 10 ^ {12} 0m1012 1 ≤ a i ≤ 1 0 5 1\leq a_i\leq 10 ^ 5 1ai105 ∑ n ≤ 1 0 6 \sum n\leq 10 ^ 6 n106

题目描述

BaoBao and DreamGrid are playing the game Plants   vs.   Zombies \textit{Plants vs. Zombies} Plants vs. Zombies. In the game, DreamGrid grows plants to defend his garden against BaoBao’s zombies.

Plants   vs.   Zombies(?) (Image   from   pixiv.   ID:   21790160;   Artist:   socha) \textit{Plants vs. Zombies(?)} \\ \textit{(Image from pixiv. ID: 21790160; Artist: socha)} Plants vs. Zombies(?)(Image from pixiv. ID: 21790160; Artist: socha)

There are n n n plants in DreamGrid’s garden arranged in a line. From west to east, the plants are numbered from 1 to n n n and the i i i-th plant lies i i

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值