Pro.ID21988 TitleLocal Extremes Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21988 AC0 Submit0 Ratio- 时间&空间限制描述You're given a sequence of integers (a1, a2, …, aN). An element ai of the sequence is called a local minimum if ai < ai-1 and ai < ai+1. A local maximum is defined similarly. Obviously, the first and the last element of the sequence can't be neither a local minimum nor a local maximum. Your task is to find the minimal value among the local maximums and the maximal value among the local minimums in the given sequence. 输入The first line of the input contains the integer N ( 1 ≤ N ≤ 1000000 ). It is followed by N integers whose absolute values do not exceed 109, the elements of the sequence. The elements are separated from each other by spaces and/or newlines. 输出Description You're given a sequence of integers (a1, a2, …, aN). An element ai of the sequence is called a local minimum if ai < ai-1 and ai < ai+1. A local maximum is defined similarly. Obviously, the first and the last element of the sequence can't be neither a local minimum nor a local maximum. Your task is to find the minimal value among the local maximums and the maximal value among the local minimums in the given sequence. Input The first line of the input contains the integer N ( 1 ≤ N ≤ 1000000 ). It is followed by N integers whose absolute values do not exceed 109, the elements of the sequence. The elements are separated from each other by spaces and/or newlines. Output The output consisting of exactly two lines. The first line should contain the minimal value among the local maximums of the sequence, or the message 'No local maximums' (without the quotes). The second line should contain the maximal value among the local minimums of the sequence, or the message 'No local minimums'. Sample Input 8 Sample Output No local maximums Source 样例输入8 样例输出No local maximums 作者 |