Removed Interval

Time Limit: 2000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5489
64-bit integer IO format: %I64d      Java class name: Main

Description

Given a sequence of numbers $A=a_1,a_2,…,a_N$, a subsequence $b_1,b_2,…,b_k$ of $A$ is referred as increasing if $b_1<b_2<…<b_k$. LY has just learned how to find the longest increasing subsequence (LIS).
Now that he has to select $L$ consecutive numbers and remove them from $A$ for some mysterious reasons. He can choose arbitrary starting position of the selected interval so that the length of the LIS of the remaining numbers is maximized. Can you help him with this problem?

Input

The first line of input contains a number $T$ indicating the number of test cases ($T≤100$).
For each test case, the first line consists of two numbers $N$ and $L$ as described above ($1≤N≤100000,0≤L≤N$). The second line consists of $N$ integers indicating the sequence. The absolute value of the numbers is no greater than $10^9$.
The sum of N over all test cases will not exceed 500000.

Output

For each test case, output a single line consisting of “Case #X: Y”. $X$ is the test case number starting from 1. $Y$ is the maximum length of LIS after removing the interval.

Sample Input

2
5 2
1 2 3 4 5
5 3
5 4 3 2 1

Sample Output

Case #1: 3
Case #2: 1

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .