21988_LocalExtremes

2022-5-16 18:20| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-8950618282099-Problem List-采集的数据-后羿采集器.html

Pro.ID

21988

Title

Local Extremes

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21988

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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
    40
    32
    5
    4
    9
    9
    2
    3

    Sample Output

    No local maximums
    4

    Source

    样例输入

    8
    40
    32
    5
    4
    9
    9
    2
    3

    样例输出

    No local maximums
    4

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部