1024 - Gold

Time Limit: 1s Memory Limit: 256MB

Submissions: 410 Solved: 85
Description
The Kingdom ALPHA has n warehouses of golds located on a straight line and are numbered 1, 2, ..., n. The warehouse i has amount of $a_i$ ($a_i$ is non-negative integer) and is located at coordinate $i$ ($\forall i=1,\dots,n$). The King of ALPHA opens a competition for hunters who are responsible to find a subset of gold warehouses having largest total amount of golds with respect to the condition that the distance between two selected warehouses must be greater than or equal to $L_1$ and less than or equal to $L_2$.	
 
 
Input
\InputFile The input consists of following lines:
\begin{itemize}
		\item Line 2 contains $n$, $L_1$, and $L_2$ ($1\leq n\leq 100000, 1\leq L_1 \leq L_2\leq n$)
		\item Line 3 contains $n$ integers $a_1,a_2,\dots,a_n$
\end{itemize}
Output
The output consists of $T$ lines, line $t$ contains only one single integer denoting the total amount of golds of selected warehouses of the test $t$ ($t=1,2,\dots,T$).

 

Sample Input
2
6  2  3
3  5  9  6  7  4
10 2 8
1 1 1 2 0 0 0 2 2 1
Sample Output
19
6
The selected warehouses of test 1 are 1, 3, 5 and the total amount of golds is 19. The selected warehouses of test 2 are 2, 4, 8, 10, and the total amount of golds is 6.
Hint
Source