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
(Edited: In fact, n <= 10^5)
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
hide comments
aristofanis:
2012-10-24 16:24:40
does an O(nk) solution pass?
|
|
Ravi Kumar:
2012-10-01 12:37:15
not even a single submission in python...why?? |
|
Romal Thoppilan:
2012-07-08 12:32:01
Please improve on your testcases .. and rejudge |
|
mahesh:
2012-07-02 18:29:13
@ priyamehtanit... check my code.. its segsev in 5th test case.c my id is 7249031 |
|
mahesh:
2012-07-02 18:29:12
@ priyamehtanit... check my code.. its segsev in 5th test case.c my id is 7249031 |
|
mahesh:
2012-07-02 18:27:01
while 5th test case running its showing as segmentation fault.. any one knows why?? |
|
spock:
2012-06-26 08:49:07
OMG...finally.. :
|
|
vishal chaudhary:
2012-06-01 08:15:37
OKAY....:) |
|
:D:
2012-06-01 06:15:17
Obviously case like N=K=10 meets all three constraints. And don't use "what the hell" just because you didn't understand the problem. Be polite! |
|
vishal chaudhary:
2012-05-31 18:20:23
question says that...n<10^6 and ..k<10^5.
|
Added by: | priyamehtanit |
Date: | 2012-02-09 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | own |