NC222459. [USACOJan20P]Non-DecreasingSubsequences
描述
输入描述
The first line contains two space-separated integers N and K.
The second line contains N space-separated integers A1,A2,…,AN.
The third line contains a single integer Q.
The next Q lines each contain two space-separated integers Li and Ri.
输出描述
For each query [Li,Ri], you should print the number of non-decreasing subsequences of ,…, mod 109+7 on a new line.
示例1
输入:
5 2 1 2 1 1 2 3 2 3 4 5 1 5
输出:
3 4 20
说明:
For the first query, the non-decreasing subsequences are (),(2), and (3). (2,3) is not a non-decreasing subsequence because A2≰A3.