Chef and Interesting Subsequences

All submissions for this problem are available.
### Read problem statements in [Hindi](http://www.codechef.com/download/translated/SEPT19/hindi/CHEFINSQ.pdf), [Bengali](http://www.codechef.com/download/translated/SEPT19/bengali/CHEFINSQ.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/SEPT19/mandarin/CHEFINSQ.pdf), [Russian](http://www.codechef.com/download/translated/SEPT19/russian/CHEFINSQ.pdf), and [Vietnamese](http://www.codechef.com/download/translated/SEPT19/vietnamese/CHEFINSQ.pdf) as well. Chef has a sequence $A_1, A_2, \ldots, A_N$. This sequence has exactly $2^N$ subsequences. Chef considers a subsequence of $A$ *interesting* if its size is exactly $K$ and the sum of all its elements is minimum possible, i.e. there is no subsequence with size $K$ which has a smaller sum. Help Chef find the number of interesting subsequences of the sequence $A$. ### Input  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first line of each test case contains two spaceseparated integers $N$ and $K$.  The second line contains $N$ spaceseparated integers $A_1, A_2, \ldots, A_N$. ### Output For each test case, print a single line containing one integer ― the number of interesting subsequences. ### Constraints  $1 \le T \le 10$  $1 \le K \le N \le 50$  $1 \le A_i \le 100$ for each valid $i$ ### Subtasks **Subtask #1 (30 points):** $1 \le N \le 20$ **Subtask #2 (70 points):** original constraints ### Example Input ``` 1 4 2 1 2 3 4 ``` ### Example Output ``` 1 ``` ### Explanation **Example case 1:** There are six subsequences with length $2$: $(1, 2)$, $(1, 3)$, $(1, 4)$, $(2, 3)$, $(2, 4)$ and $(3, 4)$. The minimum sum is $3$ and the only subsequence with this sum is $(1, 2)$.Author:  theabd1234 
Editorial  https://discuss.codechef.com/problems/CHEFINSQ 
Tags  anand20, easy, sept19, sort, theabd1234 
Date Added:  22082019 
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, rust, SCALA, swift, 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, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions