|
||||||||||
Oh My Holy FFFTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1626 Accepted Submission(s): 472 Problem Description N soldiers from the famous "*FFF* army" is standing in a line, from left to right. o o o o o o o o o o o o o o o o o o You, as the captain of *FFF*, want to divide them into smaller groups, but each group should still be continous in the original line. Like this: o o o | o o o o | o o o o o o | o o o o o In your opinion, the number of soldiers in each group should be no more than L. Meanwhile, you want your division be "holy". Since the soldier may have different heights, you decide that for each group except the first one, its last soldier(which is the rightmost one) should be strictly taller than the previous group's last soldier. That is, if we set bi as the height of the last soldier in group i. Then for i >= 2, there should be bi > bi-1. You give your division a score, which is calculated as , b0 = 0 and 1 <= k <= M, if there are M groups in total. Note that M can equal to 1. Given the heights of all soldiers, please tell us the best score you can get, or declare the division as impossible. Input The first line has a number T (T <= 10) , indicating the number of test cases. For each test case, first line has two numbers N and L (1 <= L <= N <= 105), as described above. Then comes a single line with N numbers, from H1 to Hn, they are the height of each soldier in the line, from left to right. (1 <= Hi <= 105) Output For test case X, output "Case #X: " first, then output the best score. Sample Input
Sample Output
Source | ||||||||||
|