excavator

Hills——一道转移方程很“有趣”的线性DP

浪尽此生 提交于 2020-10-24 12:56:58
题目描述 Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i -th of them has height a i . The Innopolis administration wants to build some houses on the hills. However, for the sake of city appearance, a house can be only built on the hill, which is strictly higher than neighbouring hills (if they are present). For example, if the sequence of heights is 5, 4, 6, 2, then houses could be built on hills with heights 5 and 6 only. The Innopolis administration has an