#C8391. Highest Peak Finder
Highest Peak Finder
Highest Peak Finder
You are given a series of test cases. In each test case, you are provided with a sequence of scores obtained from different challenges. Your task is to determine the highest peak point in each sequence.
A score at index i is considered a peak if it satisfies the following conditions:
- If i = 0 (the first element), it is a peak if \(a_0 > a_1\).
- If i = N-1 (the last element), it is a peak if \(a_{N-1} > a_{N-2}\).
- For any other index \(0 < i a_{i-1}\) and \(a_i > a_{i+1}\).
If the sequence contains only one score, that score is trivially considered a peak. In the case that a sequence does not contain any peak according to the above conditions, you should output No Peak
.
inputFormat
The input is read from standard input (stdin) and has the following format:
T N1 s1 s2 ... sN1 N2 s1 s2 ... sN2 ... NT s1 s2 ... sNT
Where:
T
is the number of test cases.- For each test case, the first line contains an integer
N
, the number of scores. - The next line contains
N
space-separated integers representing the scores.
outputFormat
For each test case, output on a separate line the highest peak found in the sequence. If no peak is found, output No Peak
.
3
5
1 3 7 4 2
6
10 5 1 2 10 7
4
5 5 5 5
7
10
No Peak
</p>