F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Supermarket

Time 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
1 3 5 7 6 5 3 5
 

Sample Output
66549669
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 07:12:30, Gzip enabled