HBC223708[NOIP1999]回文数,字符串,NOIP复赛FarmingMars题解

凸凸曼凸凸 算法基础篇 48 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
It has been ten years since the miserable day that you won a one-way ticket to Mars on a game show. Your colony’s attempt at terraforming Mars has faced nothing but hardship during that time. The la

It has been ten years since the miserable day that you won a one-way ticket to Mars on a game show. Your colony’s attempt at terraforming Mars has faced nothing but hardship during that time. The latest disaster: a complete failure of the potato crop. You will have to start planting potatoes again from scratch. Your colony has prepared an n-acre strip of arable land on which you will attempt to plant new potatoes.  Your scientists have developed bioengineered potatoes that can withstand the harsh Martian climate and almost complete lack of atmosphere. Unfortunately, these potatoes have extreme sensitivity to pH: they will only thrive if the pH of the soil is exactly right, down to six decimal digits. Your bioengineers can create new potato varieties with any specific allowable pH value, but doing so is only economical if you can then plant a large patch of the variety on a continuous interval [l, r] of the n-acre strip. Given a list of pH values measured on each acre of the strip, and a list of potential subintervals [l, r] where you are considering planting potatoes, compute whether a strict majority ⌊r−l+1)/2⌋+1lfloor r−l+1)/2rfloor+1⌊r−l+1)/2⌋+1 of the acres within the interval all share the exact same pH value (otherwise it is not worth trying to plant potatoes there). Note that these acres with equal pH value do not need to be contiguous, so long as they all lie within the interval [l, r].

HBC223708[NOIP1999]回文数,字符串,NOIP复赛FarmingMars题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC223708[NOIP1999]回文数 字符串 NOIP复赛FarmingMars题解