An array of sizen≤ 106is given to you. There is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Each time the sliding window moves rightwards by one position. Following is an example: The array is[13-1-35367], andkis 3. Window position Minimum value Maximum value [13-1]-35367 -1 3 1[3-1-3]5367 -3 3 13[-1-35]367 -3 5 13-1[-353]67 -3 5 13-1-3[536]7 3 6 13-1-35[367] 3 7 Your task is to determine the maximum and minimum values in the sliding window at each position.
An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves rightwards by one position. Following is an example: The array is [1 3 -1 -3 5 3 6 7], and k is 3. Window position Minimum value Maximum value [1 3 -1] -3 5 3 6 7 -1 3 1 [3 -1 -3] 5 3 6 7 -3 3 1 3 [-1 -3 5] 3 6 7 -3 5 1 3 -1 [-3 5 3] 6 7 -3 5 1 3 -1 -3 [5 3 6] 7 3 6 1 3 -1 -3 5 [3 6 7] 3 7 Your task is to determine the maximum and minimum values in the sliding window at each position.

 
    		 
   			
    		 
 
                 
 
                 
 
                 
 
                 
 
                ![HBC23482[SCOI2008]城堡CASTLE,贪心,二分,最短路,动态规划,图论,分治小A的最短路题解
(从当前的一个景区移动到下一个景点需要消耗一点的体力值) HBC23482[SCOI2008]城堡CASTLE,贪心,二分,最短路,动态规划,图论,分治小A的最短路题解
(从当前的一个景区移动到下一个景点需要消耗一点的体力值)](https://www.xxstcz.com/zb_users/cache/thumbs/14b6295e968a24eea812b327e2150b1d-320-200-1.jpeg)