CHEF AND INCREASING SUBSEQUENCES
All submissions for this problem are available.
Chef became a problem setter on Codechef.He is creating a problem on sub-sequences.
Statement: You are given an array A of N elements and Q queries.
Each query gives a single integer x for which you have to output the number of strictly increasing sub sequences of length x in the given array.
Before Chef creates its solution,his girlfriend calls him to go for a long drive. As he cannot say no to his girlfriend and he has to submit the problem for Code Marathon contest tomorrow, he ask you to create the solution for the problem.
The first line contains T, the number of testcases.
The first line of each testcase contain two space separated intgers N Q, and the second line contain N space separated integers A1, A2, A3, ......., AN.
Then the next Q lines follow the queries of type : x.
For each query, output the required answer modulo 1000000007 in a separate line.
1 ≤ T ≤ 10 1 ≤ N ≤ 200 1 ≤ Q ≤ N -10^9 ≤ Ai ≤ 10^9 1 ≤ x ≤ N
Input: 1 5 5 1 2 3 4 5 1 2 3 4 5 Output: 5 10 10 5 1
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions