{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"th\"\u003e\n An array of size \n \u003ci\u003en\u003c/i\u003e ≤ 10\n \u003csup\u003e6\u003c/sup\u003e is given to you. There is a sliding window of size \n \u003ci\u003ek\u003c/i\u003e which is moving from the very left of the array to the very right. You can only see the \n \u003ci\u003ek\u003c/i\u003e numbers in the window. Each time the sliding window moves rightwards by one position. Following is an example: \n \u003cbr\u003eThe array is \n \u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e[1\u0026nbsp;3\u0026nbsp;-1\u0026nbsp;-3\u0026nbsp;5\u0026nbsp;3\u0026nbsp;6\u0026nbsp;7]\u003c/font\u003e, and \n \u003ci\u003ek\u003c/i\u003e is 3.\n \u003ctable frame\u003d\"BOX\" rules\u003d\"ALL\"\u003e\n \u003ctbody\u003e\n \u003ctr align\u003d\"CENTER\"\u003e\n \u003cth\u003eWindow position\u003c/th\u003e\n \u003cth\u003eMinimum value\u003c/th\u003e\n \u003cth\u003eMaximum value\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr class\u003e\n \u003ctd\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e[1\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;-1]\u0026nbsp;-3\u0026nbsp;\u0026nbsp;5\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;6\u0026nbsp;\u0026nbsp;7\u0026nbsp;\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e-1\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e3\u003c/font\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr class\u003e\n \u003ctd\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e\u0026nbsp;1\u0026nbsp;[3\u0026nbsp;\u0026nbsp;-1\u0026nbsp;\u0026nbsp;-3]\u0026nbsp;5\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;6\u0026nbsp;\u0026nbsp;7\u0026nbsp;\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e-3\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e3\u003c/font\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr class\u003e\n \u003ctd\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e\u0026nbsp;1\u0026nbsp;\u0026nbsp;3\u0026nbsp;[-1\u0026nbsp;\u0026nbsp;-3\u0026nbsp;\u0026nbsp;5]\u0026nbsp;3\u0026nbsp;\u0026nbsp;6\u0026nbsp;\u0026nbsp;7\u0026nbsp;\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e-3\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e5\u003c/font\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr class\u003e\n \u003ctd\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e\u0026nbsp;1\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;-1\u0026nbsp;[-3\u0026nbsp;\u0026nbsp;5\u0026nbsp;\u0026nbsp;3]\u0026nbsp;6\u0026nbsp;\u0026nbsp;7\u0026nbsp;\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e-3\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e5\u003c/font\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr class\u003e\n \u003ctd\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e\u0026nbsp;1\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;-1\u0026nbsp;\u0026nbsp;-3\u0026nbsp;[5\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;6]\u0026nbsp;7\u0026nbsp;\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e3\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e6\u003c/font\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr class\u003e\n \u003ctd\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e\u0026nbsp;1\u0026nbsp;\u0026nbsp;3\u0026nbsp;\u0026nbsp;-1\u0026nbsp;\u0026nbsp;-3\u0026nbsp;\u0026nbsp;5\u0026nbsp;[3\u0026nbsp;\u0026nbsp;6\u0026nbsp;\u0026nbsp;7]\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e3\u003c/font\u003e\u003c/td\u003e\n \u003ctd align\u003d\"RIGHT\"\u003e\u003cfont face\u003d\"Courier New,Courier,monospace\" size\u003d\"2\"\u003e7\u003c/font\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e\n \u003cp\u003eYour task is to determine the maximum and minimum values in the sliding window at each position. \u003cbr\u003e\u003c/p\u003e\n \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"th\"\u003e\n The input consists of two lines. The first line contains two integers \n \u003ci\u003en\u003c/i\u003e and \n \u003ci\u003ek\u003c/i\u003e which are the lengths of the array and the sliding window. There are \n \u003ci\u003en\u003c/i\u003e integers in the second line. \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"th\"\u003e\n There are two lines in the output. The first line gives the minimum values in the window at each position, from left to right, respectively. The second line gives the maximum values. \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e8 3\n1 3 -1 -3 5 3 6 7\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e-1 -3 -3 -3 3 3\n3 3 5 5 6 7\n\u003c/pre\u003e"}}]}