CF982D Shark
题目描述
科学家们研究鲨鱼的习性已经有一段很长的时间了。鲨鱼,就像其他的生物一样,在某一地点交替短途移动, 并在不同地点之间长途移动。
Max 是一位年轻的生物学家。他观察一只特别的鲨鱼已有 $n$ 天,现在他也清楚地知道这只鲨鱼在某一天游动的距离。每天鲨鱼游动的距离都是不同的。Max 想知道鲨鱼抵达了多少个位置。他假定:如果鲨鱼在某天游动的距离严格小于 $k$,那么它的位置不发生变化;否则,如果鲨鱼在某天游动的距离大于或等于 $k$,则它的位置在那天发生了变化。注意:有可能鲨鱼的位置连续几天都发生了变化,只要这几天每天鲨鱼游动的距离都至少为 $k$。
从某个地方游走后,鲨鱼就不会再回来了。也就是说,我们可以将这个 $n$ 天的序列划分成若干断连续的、非空子段,使得每一子段内每天鲨鱼游动的距离都小于 $k$,那么每一个子段就代表一个位置。Max 想找出这样的 $k$,使得每个子段的长度都相等。
找到这样的整数 $k$,令位置的数量尽可能地多。如果存在多个满足条件的 $k$,输出最小的一个。
输入格式
无
输出格式
无
说明/提示
In the first example the shark travels inside a location on days $ 1 $ and $ 2 $ (first location), then on $ 4 $ -th and $ 5 $ -th days (second location), then on $ 7 $ -th and $ 8 $ -th days (third location). There are three locations in total.
In the second example the shark only moves inside a location on the $ 2 $ -nd day, so there is only one location.