|
||||||||||
SupermarketTime Limit: 5000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 156 Accepted Submission(s): 72 Problem Description There were supermarkets in ancient times. But stories in the ancient supermarkets were always forgotten by people. The background of the story is like this: There are $n$ kinds of items and $m$ shopping records in a contemporary supermarket. Each shopping record tells us how many items a person bought for each kind at a certain time. The manager of the supermarket wants to analyze $m$ records and extract some rules. People design many algorithms for this such as classical apriori algorithm. A rule can be formulated as follows: A person will buy all kinds of items in $T$ with the high probability, in the condition that he has bought all kinds of items in the record $S$ . Your task is to extract useful rules for making more money. One day, you find the task is so simple for you, so you decide to improve the difficulty. Obviously, each shopping record may contain items of the same kind which aren't related for you to extract useful rules. You plan to delete redundant information and keep the kinds for each shopping record. In other words, all kinds of items in a record will be represented as a set $A$ after removing repetitive items. Now we uses an integer $A_i(A_i\in[0,2^n))$ to stand for the $i$-th record which contains the kinds of items. For example,$n=4,A_i=(0101)_2$ means that the record contains the $1$st kind of items and the $3$rd kind of items. Define $P(T|S)$ the probability that a person can get a shopping record containing $T$ if he chooses one randomly from all records containing $S$ in equal probability. Notice that if there is no record containing $S$ , then $P(T|S)=0$ whatever $T$ is. For example,$P(\{ "pen","paper","earser" \}|\{ "book","pen" \})$ means the probability that a person buys pens,paper and earsers if he have bought books and pens. $P(\{ "pen","paper","earser" \}|\{ "book","pen" \})=0$ if there is no record containing $\{ "book","pen" \}$. Please compute$$\displaystyle \sum_{S\in[0,2^n)}\sum_{T\in[0,2^n)}P(T|S)$$ modulo $998244353$. Input The first line contains an integer $T(T \le 15)$. Then $T$ test cases follow. For each test case the first line contains two integers $n\in[1,20]$,$m\in[1,2 \times 10^5]$. The $i$-th line of the following lines contains an integer $A_i\in[0,2^n)$. Output For each test case print the answer modulo $998244353$. Sample Input
Sample Output
Source | ||||||||||
|