#P4392. [BalticOI 2007] Sound 静音问题
[BalticOI 2007] Sound 静音问题
Description
In digital audio recording, sound is represented by a sequence of numbers describing air pressure, with each value called a sample, and adjacent samples separated by equal time intervals.
Many audio processing tasks need to split the recorded sound into non-silent segments separated by silence. To avoid producing too many or too few non-silent segments, silence is defined as follows: a sequence of samples in which the difference between the maximum and the minimum sample values does not exceed a given threshold .
Write a program to detect silence within samples.
Input Format
The first line contains three integers (, , ), denoting the total number of samples, the length of a silence segment, and the maximum allowed noise level within a silence segment.
The second line contains integers (), the value of each sample, separated by spaces.
Output Format
List all starting positions of silence segments (i.e., those such that $\max\{a_i, a_{i+1}, \ldots, a_{i+m-1}\} - \min\{a_i, a_{i+1}, \ldots, a_{i+m-1}\} \le c$). Output one starting position per line, in order of appearance. If there is no silence, output NONE.
7 2 0
0 1 1 2 3 2 2
2
6
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号