#K73437. Peak Signal Detection
Peak Signal Detection
Peak Signal Detection
You are provided with a sequence of n integer signals. A signal is considered a peak if it is strictly greater than its neighboring signals. For the first and last elements, only one neighbor exists, so the condition applies only to that one neighbor.
Your task is to determine the number of peak signals in the given sequence and output the 1-indexed positions of these peaks.
Note: When the sequence has only one element, there are no peaks.
inputFormat
The first line contains a single integer n
(the number of signals). The second line contains n
space-separated integers representing the signal values.
outputFormat
The output consists of two lines. The first line should contain the count of peak signals. The second line should contain the 1-indexed positions of the peak signals, separated by a single space. If there are no peak signals, output an empty second line.
## sample1
5
0
</p>