Sounds and Silences
In the digital recording of sound, sound is described by a sequence of integers representing measurements at regular time intervals. Each value in the sequence is called a sample.
In many audio processing applications, we are interested in silences. Silences are intervals of samples of size where the difference between the minimum and maximum value does not exceed a threshold value .
Problem:
Develop a program in one of the IOI languages which, after reading the values of , , and , as well as the integers corresponding to the digital recording of a sound, identifies the silences.
Input Files:
The input files named sound.in are text files with the following structure: The first line contains three integers , , and , separated in pairs by a single space. The second line contains sequentially the integers , , , , corresponding to the samples of the digital sound recording, separated in pairs by a single space. These integers will be between and .
Output Files:
The output files named sound.out are text files with the following structure: Each line contains one value of such that
The values of should appear in ascending order.
Note: We assume that the numbering of samples starts from (i.e., the first sample is and the last sample is ).
If there is no such value of , the output file should contain only one line with the word "".
Example of Input - Output Files:
STDIN (sound.in)
7 2 0
0 1 1 2 3 2 2
STDOUT (sound.out)
2
6
Explanation of the Example:
In this example of samples, a silence is a sequence of samples where the difference between their minimum and maximum value does not exceed (meaning silences are pairs of samples with the same value). There are two silences: , (starting from position ) and , (starting from position ).
Formatting: In the output, each line terminates with a newline
character.
Maximum execution time: 1 sec.
Maximum available memory: 64 MB.
Comments