| Author: | Pavel Mesenev | Time limit: | 2 sec | |
| Input file: | Standard input | Memory limit: | 256 Mb | |
| Output file: | Standard output |
You are given an array a0, a1, …, an − 1 of integers and a window size k. For every contiguous window of size k, output the maximum value in that window. There are n − k + 1 windows in total.
The first line contains two integers n and k. The second line contains n space-separated integers a0… an − 1.
Print n − k + 1 space-separated integers: the maximum of each window, in order.
1 ≤ k ≤ n ≤ 2 ⋅ 105
− 109 ≤ ai ≤ 109
| No. | Standard input | Standard output |
|---|---|---|
| 1 |
|
|
| 2 |
|
|
| 3 |
|
|