#P2032. Sliding Board Maximum
Sliding Board Maximum
Sliding Board Maximum
We are given a matrix that contains integers. A wooden board, which can cover consecutive numbers, is initially placed on the first numbers of the matrix. Then, the board is moved one unit to the right repeatedly until its right end coincides with the element of the matrix. Before each move (including the initial position), output the maximum value among the numbers currently covered by the board.
inputFormat
The first line contains two integers and (). The second line contains integers representing the matrix values.
outputFormat
Output exactly lines. Each line should contain a single integer, which is the maximum among the numbers covered by the board at that position.
sample
5 3
1 3 2 5 4
3
5
5
</p>