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
each testcase 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.
each testcase 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’.
8 40 32 5 4 9 9 2 3
No local maximums 4
Migrated from old NTUJ.
icpc2008, neerc west
No. | Testdata Range | Score |
---|