#P2032. 扫描
扫描
Description
There is a array containing integers.
You are given a plank that can cover consecutive numbers.
At the beginning, the plank covers the numbers of the array. Each time, move the plank one unit to the right until its right end coincides with the -th number.
Before each move, output the maximum among the numbers currently covered by the plank.
Input Format
The first line contains two integers , meaning there are numbers and the plank can cover consecutive numbers.
The second line contains integers, which are the elements of the array.
Output Format
Output lines, one integer per line.
The -th line is the maximum value among the numbers.
5 3
1 5 3 4 2
5
5
4
Hint
- For of the testdata, .
- For of the testdata, .
- For of the testdata, , and each element in the array is a positive integer not exceeding .
Translated by ChatGPT 5
京公网安备 11011102002149号