当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7019:Supermarket

题目描述
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$.
输入解释
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)$.
输出解释
For each test case print the answer modulo $998244353$.
输入样例
1
3 5
7
6
5
3
5
输出样例
66549669

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7019

最后修改于 2021-10-23T19:11:04+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000/3000MS(Java/Others) 262144/262144K(Java/Others)