Problem B
Alice in the Digital World
After returning from Wonderland, Alice needs to improve her scientific skills in the current digital world. Alice decides to participate the ACM - ICPC Asia Nha Trang Regional Contest 2016 to evaluate her actual performance. Her favorite problem in the contest is described below.
Given an array of positive integers
Given an integer
Input
The input consists of several datasets. The first line of
the input contains the number of datasets, which is a positive
number and is not greater than
Each dataset is described by the following lines:
-
The first line contains two positive integers
and where and ; -
The second line contains
positive integers, each with value at most .
Output
For each dataset, output the maximum weight.
Sample Input 1 | Sample Output 1 |
---|---|
1 6 2 1 3 2 6 2 4 |
12 |