LIS Number
Time limit1sMemory limit1024 MB
Count the ways to delete elements from a length-N sequence so that its LIS Number equals K, modulo 1,000,000,007.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Prefix sum, Array
- Solved
- No attempts yet
Problem
The LIS Number of a sequence of integers is the smallest positive integer such that can be obtained by concatenating strictly increasing sequences. For example, the LIS Number of is 4. You can get as , but not with 3 or fewer sequences. The LIS Number of a strictly increasing sequence is 1.
You are given a sequence of length and an integer . You want to transform the given sequence into a sequence with LIS Number . The only operation you can perform is deleting 0 or more numbers from the original sequence. Count the number of ways to do this. Two ways are different if the sets of removed positions (indices) are different.
Input
The first line contains a positive integer , the number of test cases. The first line of each test case contains two integers () and (). The second line contains integers of the sequence, separated by single spaces. Each integer is between 0 and 100000, inclusive.
Output
For each test case, output the number of ways to transform the given sequence of length into a sequence with LIS Number . Since the count can be very large, output it modulo .