#P2032. 扫描

扫描

Description

There is a 1×n1 \times n array containing nn integers.

You are given a plank that can cover kk consecutive numbers.

At the beginning, the plank covers the 1k1 \sim k numbers of the array. Each time, move the plank one unit to the right until its right end coincides with the nn-th number.

Before each move, output the maximum among the numbers currently covered by the plank.

Input Format

The first line contains two integers n,kn, k, meaning there are nn numbers and the plank can cover kk consecutive numbers.

The second line contains nn integers, which are the elements of the array.

Output Format

Output nk+1n - k + 1 lines, one integer per line.

The ii-th line is the maximum value among the ii+k1i \sim i + k - 1 numbers.

5 3
1 5 3 4 2

5
5
4

Hint

  • For 20%20\% of the testdata, 1kn1031 \leq k \leq n \leq 10^3.
  • For 50%50\% of the testdata, 1kn1041 \leq k \leq n \leq 10^4.
  • For 100%100\% of the testdata, 1kn2×1061 \leq k \leq n \leq 2 \times 10^6, and each element in the array is a positive integer not exceeding 10410^4.

Translated by ChatGPT 5