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

建议使用的浏览器:

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

6851:Heart

题目描述
Notice:Don't output extra spaces at the end of one line.

Koishi loves her heart.

Koishi's heart are divided into 21 pieces, indexed from $0$ to $20$. She has $n$ kinds of danmaku, using the $i$-th danmaku needs the help of a subset $b_i$ of her heart pieces and has aggressivity $p_i$. Suppose $A$ is a subset of her $n$ danmakus. If for any two different kinds of danmaku $u,v\in A,u\neq v$, it guarantees $b_u\cap b_v=\emptyset$, then we call $A$ a spellcard(because danmaku in the same spellcard must be released simultaneously, and one piece of heart can only supply one kind of damaku at the same time). The aggressivity of the spellcard $A$ is product of aggressivities of all danmakus belongs to $A$. Obviously, using spellcard $A$ needs the help of heart pieces. The related pieces subset is $S(A)=\cup_{u\in A}b_u$.

Koishi wants to know some details about her spellcards. She will ask $m$ questions, in the $i$-th question, she wants to know the sum of aggressivities of all her spellcard $A$ whose $S(A)=x_i$, $x_i$ is a subset of heart pieces. You must answer all the questions correctly. modulo 998244353
输入解释
There are only one test case.

First line contains a positive integer $n(1\leq n\leq 10^6)$, the number of danmakus.

The $i$-th line of the following $n$ lines contains two non-negative integers $p_i,b_i(0\leq p_i<998244353,0\leq b_i<2^{21})$, describing the $i$-th danmaku, writing integer $b_i$ as binary string will get the subset $b_i$

The following integer contains a positive $m(1\leq m\leq 10^6)$, the number of questions.

The $i$-th line of the following $m$ lines contains a non-negative integer $x_i(0\leq x_i<2^{21})$, describing the $i$-th question.
输出解释
Output $m$ lines, and the $i$-th line should contain a non-negative integer as the answer of the $i$-th question
输入样例
3
1 1
1 2
1 3
3
1
2
3
输出样例
1
1
2
来自杭电HDUOJ的附加信息
Recommend IceyWang

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

源链接: HDU-6851

最后修改于 2020-10-25T23:34:55+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
40000/20000MS(Java/Others) 524288/524288K(Java/Others)