AKVLKO03 - Geeky World
Ross is a geek but he never admits it. He plays weird geeky games and enjoys them a lot. Recently he started playing a new game. He takes an array of "N" integers. Then he makes another array out of it which contains the sum of all the contiguous sub arrays of the original array. He sorts them is non-increasing order and keeps them in an array S that has 1-based index. Now he wants the find the elements at position K1, K2 and K3 in it.
For example, if the array has 3 elements {10, 20, 30}, then the formed array will have 6 elements as S[1..6] = {60, 50, 30, 30, 20, 10}.
Input
First line of the input will contain 4 integers "N", "K1", "K2" and "K3". The next line will contain "N" integers A[0], A[1] ... A[N-1].
Output
Output three integers, the elements at position K1, K2 and K3 in the formed array separated by a single space.
Constraints
2 <= N <= 10^4
1 <= K1 <= K2 <= K3 <= 2000
K3 <= N*(N+1)/2
-10^4 <= A[i] <= 10^4
Example
Input: 3 1 3 6 10 20 30 Output: 60 30 10
Input: 4 2 6 10 20 -15 10 -15 Output: 15 -5 -20
Added by: | Ankit Kumar Vats |
Date: | 2013-08-30 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |