----
>我的GIS/CS学习笔记:https://github.com/yunwei37/ZJU-CS-GIS-ClassNotes
<一个浙江大学本科生的计算机、地理信息科学知识库 >
还有不少数据结构和算法相关的笔记以及pta题解哦x
----
PTA top level 练习里面的一道题目...挺简单的,就是读懂题目然后注意一下边界条件。
是浙江大学高级数据结构与算法课程的一个小作业啦
# 思路
就是两个最大上升子序列,从正反两个方向进行,然后把结果叠加到一起就好啦。不算注释的话30行代码...可以说非常少了x
In many research areas, one important target of analyzing data is to find the best "peak shape" out of a huge amount of raw data full of noises. A "peak shape" of length L is an ordered sequence of L numbers { D1, ⋯, DL } satisfying that there exists an index i (1<i<L) such that D1<⋯<Di−1<Di>Di+1>⋯>DL.
Now given N input numbers ordered by their indices, you may remove some of them to keep the rest of the numbers in a peak shape. The best peak shape is the longest sub-sequence that forms a peak shape. If there is a tie, then the most symmetric (mea