CF66B.Petya and Countryside
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed height and due to the newest irrigation system we can create artificial rain above each section.
Creating artificial rain is an expensive operation. That's why we limit ourselves to creating the artificial rain only above one section. At that, the water from each watered section will flow into its neighbouring sections if their height does not exceed the height of the section. That is, for example, the garden can be represented by a 1 × 5 rectangle, where the section heights are equal to 4, 2, 3, 3, 2. Then if we create an artificial rain over any of the sections with the height of 3, the water will flow over all the sections, except the ones with the height of 4. See the illustration of this example at the picture:

As Petya is keen on programming, he decided to find such a section that if we create artificial rain above it, the number of watered sections will be maximal. Help him.
小佩佳经常去乡下的奶奶家。奶奶家有一个很大的花园,从上方看可以表示为一个 1×n 的矩形。该矩形被划分为 n 个相等的正方形区域。这个花园非常特别:每个正方形区域都有其固定的海拔高度,并且由于配备了最新的灌溉系统,我们可以在任意一个区域的上方实施人工降雨。
人工降雨是一项昂贵的操作,因此我们仅允许在恰好一个区域的上方实施人工降雨。此时,被浇灌区域中的水会向其相邻区域流动,当且仅当相邻区域的海拔高度不超过该被浇灌区域的海拔高度。例如,花园可表示为一个 1×5 的矩形,各区域海拔高度依次为 4,2,3,3,2。若我们在任一海拔为 3 的区域上方实施人工降雨,则水将流遍除海拔为 4 的区域外的所有区域。该示例图示如下:

由于佩佳热衷于编程,他决定找出这样一个区域:若仅在该区域上方实施人工降雨,则被润湿(即有水流到达)的区域数量达到最大。请你帮助他完成这一任务。
输入格式
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
第一行包含一个正整数 n(1≤n≤1000)。第二行包含 n 个正整数,表示各段的高度。所有数字均不小于 1 且不大于 1000。
输出格式
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
输出一个整数,表示若仅在恰好一个区域上方制造人工降雨,所能浇灌的区域数量的最大值。
输入输出样例
输入#1
1 2
输出#1
1
输入#2
5 1 2 1 2 1
输出#2
3
输入#3
8 1 2 1 1 1 3 3 4
输出#3
6
输入解题思路,AI测评打分。不知道怎么写?