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

建议使用的浏览器:

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

6131:Loop nest

题目描述
There are $m$ sets $P_i,Q_i$,$\forall i(1\leq i\leq m),Pi,Qi\subseteq \{1…i-1\}$. There are nested loops with $m$ layers, and for the $j$th layer, the loop variable is $i_j$, the lower bound equals $\max\{i_k(k\in P_j)\}$(especially, when $P_j$ is empty set, it means the lower bound equals $1$), the upper bound equals $\min\{i_k(k\in Q_j)\}$(especially, when $Q_j$ is empty set, it means the upper bound equals $n$). HazelFan want to know how many times the loop body will be executed, module $p$.
输入解释
The first line contains a positive integer $T(1\leq T\leq5)$, denoting the number of test cases.
For each test case:
The first line contains three positive integers $m,n,p(1\leq m\leq15,1\leq n\leq10^9,2\leq p\leq10^9+7)$.
The next $m$ lines, the $i$th line contains several nonnegative integers describing the sets $P_i,Q_i$. The first integer is $A_i$, denoting the size of $P_i$, then next $A_i$ integers denotes the elements of $P_i$. The next integer is $B_i$, denoting the size of $Q_i$, then next $B_i$ integers denotes the elements of $Q_i$.
输出解释
For each test case:
A single line contains a nonnegative integer, denoting the answer.
输入样例
2
2 10 233
0 0
1 1 0
6 10 987654321
0 0
1 1 0
0 0
1 3 0
0 1 4
1 2 2 1 2
输出样例
55
3850
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6131

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

共提交 0

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