ARRAYSUB  subarrays
Given an array and an integer k, find the maximum for each and every contiguous subarray of size k.
Input
the number n denoting number of elements in the array then after a new line we have the numbers of the array
and then k in a new line
n<10^6
k<10^5
1 <= k <=n
and each element of the array is between 0 and 10^6
Output
print the output array
Example
Input: 9
1 2 3 1 4 5 2 3 6 3 Output: 3 3 4 5 5 5 6
Added by:  priyamehtanit 
Date:  20120209 
Time limit:  0.222s0.972s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel Pentium G860 3GHz) 
Languages:  All except: SCM chicken 
Resource:  own 
hide comments
Shubham Bansal:
20150328 06:29:55
i was trying to solve dis ques using set stl, showing correct answer for all the test cases i can think of, but showing wrong answer..


RAJDEEP GUPTA:
20150327 19:38:04
While solving using JAVA, it gave me NZEC when used BufferedReader for taking inputs. Got AC using Scanner class and O(n) algo. 

Indian Cyber Army (IndiShell):
20150210 09:45:45
ac in 1 go with brute force .. ! 

Nikhil Agarwal:
20150128 12:32:36
those getting wrong answer in 5 add spaces between integers 

Madhav:
20150126 11:37:55
learnt something new known as window sliding!! Last edit: 20150126 12:00:20 

vishal:
20150126 10:00:52
nice question..!! 

Abhinandan Agarwal:
20150124 08:51:12
O(n) solution should only be accepted B)


vivek singh rana:
20150121 13:44:25
2 dp...enjoyed a lot!!! 

kailash:
20150121 10:34:17
window sliding :) 

tyler_durden:
20150115 06:52:35
it will be really unfair if you donot solve it in O(n) 