Xiao Ming facevalue

TimeLimit:4000MS  MemoryLimit:256MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

One day, Xiao Ming accidentally picked up a magic lamp. The lamp god said to Xiao Ming that he could satisfy his wish. Xiao Ming made a wish to the lamp god to make himself more handsome, so the lamp god promised him.

But the lamp god did not simply realize this wish for him. He gave Xiao Ming a sequence A containing n integers, and let him pick m numbers in A. The sum of the m numbers is handsome value which Xiao Ming will finally get.

Of course, Xiao Ming definitely thinks that the higher the handsome value, the better, but things are not so simple, the exact rules are defined as follows:

1. Xiao Ming selected a sequence b, b1, b2, b3 … bm (bi denotes the subscript in A, 1<=b1<b2<b3<… <bm<=n)

2. Any b[i] must satisfy b[i-1]+k>=b[i].(1<i<=m)

3. Xiao Ming's handsome value S=A[b1]+A[b2]+A[b3]+...+A[bm]

For the stupid Xiao Ming, he can only pick m number randomly, but he wants to get the most handsome value, so he asked you to help. Can you help him?

Hang:这题我不会翻译

Input

The first line contain an integer t indicates the number of questions asked (1 <= t <= 20).

Next, the first line of each query contains two spaces separated by an integer n, m, k.

The next n integers are the n integers of sequence A.

(1<=k,m<=n<=3000. 0<=A[i]<=1e5)

(guarantee all inquiries ∑n<=3000) 


Output

For each query, output a line of integers indicating the value of the maximum handsome value. 


SampleInput
2
5 2 2
20 1 18 2 19
13 4 3
10 0 0 0 8 0 0 0 9 0 0 0 7
SampleOutput
38
19
Submit
题目统计信息详细
总AC数47
通过人数15
尝试人数18
总提交量130
AC率11.54%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: