Subarray minimum - MarisaOJ: Marisa Online Judge

Subarray minimum

Time limit: 1000 ms
Memory limit: 256 MB
Consider an array $A$ consisting of $n$ integers. For each subarray of length $k$, find its minimum value. ### Input - The first line contains two integers $n,k$. - The second line contains $n$ integers $A_i$. ### Output - Print $n - k + 1$ integers, the $i^{th}$ is the minimum value in the subarray $A_{i,i+k-1}$. ### Constraints - $1 \le n,k \le 10^5$. - $1 \le A_i \le 10^9$. ### Example Input: ``` 3 2 1 2 3 ``` Output: ``` 1 2 ```