Baltic Olympiad in Informatics: 2007 Day 1, Problem 3
In digital recording, sound is described by a sequence of numbers representing the air pressure, measured at a rapid rate with a fixed time interval between successive measurements. Each value in the sequence is called a sample.
An important step in many voice-processing tasks is breaking the recorded sound into chunks of
non-silence separated by silence. To avoid accidentally breaking the recording into too few or too
many pieces, the silence is often defined as a sequence of
Write a program to detect silence in a given recording of
Input Specification
The first line of the file contains three integers:
The second line of the file contains
Output Specification
The output should list all values of
If there is no silence in the input, write NONE
on the first and only line of the output.
Sample Input
7 2 0
0 1 1 2 3 2 2
Sample Output
2
6
Comments
If you're getting MLE on Java, it may be because you're using
BufferedReader
and callingbr.readLine()
. 32M is not big enough to hold the second line of input, which can be very long.java.util.Scanner
is too slow. I usedbr.read()
to take input: