This is a Giveaway!!
All submissions for this problem are available.As it is New Year, let’s keep this question straight forward. You are given an array $A$ of $N$ integers $A_1, …… A_N$. A good sequence is defined as a non-empty sequence of integers such that the sum of elements in **each** and **every** of its sub-sequence is divisible by $M$. Can you find the total number of good sub-sequences of the array $A$? [**Note**: a sub-sequence is a sequence that can be derived from the original sequence by deleting some or no elements without changing the order of the remaining elements.] ###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 space-separated integers $N$, $M$. - The second line contains $N$ space separated integers $A_1, A_2, …. A_N$. ###Output: For each test case, print a single line containing a single integer denoting the total number of good sub-sequences. ###Constraints - $1 \leq T \leq 1000$ - $1 \leq N \leq 30$ - $0 \leq A_i \leq 10^9$ - $1 \leq M \leq 10^6$ ###Sample Input:
2 2 3 1 2 2 3 1 3###Sample Output:
|Tags||cakewalk, cnxh2020, kishen1912000, math|
|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|
Fetching successful submissions
If you are still having problems, see a sample solution here.