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

建议使用的浏览器:

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

5399:Too Simple

题目描述
Rhason Cheung had a simple problem, and asked Teacher Mai for help. But Teacher Mai thought this problem was too simple, sometimes naive. So she ask you for help.

Teacher Mai has $m$ functions $f_1,f_2,\cdots,f_m:\{1,2,\cdots,n\}\to\{1,2,\cdots,n\}$(that means for all $x \in \{1,2,\cdots,n\},f(x)\in \{1,2,\cdots,n\}$). But Rhason only knows some of these functions, and others are unknown.

She wants to know how many different function series $f_1,f_2,\cdots,f_m$ there are that for every $i(1\leq i\leq n)$,$f_1(f_2(\cdots f_m(i)))=i$. Two function series $f_1,f_2,\cdots,f_m$ and $g_1,g_2,\cdots,g_m$ are considered different if and only if there exist $i(1\leq i\leq m),j(1\leq j\leq n)$,$f_i(j)\neq g_i(j)$.
输入解释
For each test case, the first lines contains two numbers $n,m(1\leq n,m\leq 100)$.

The following are $m$ lines. In $i$-th line, there is one number $-1$ or $n$ space-separated numbers.

If there is only one number $-1$, the function $f_i$ is unknown. Otherwise the $j$-th number in the $i$-th line means $f_i(j)$.
输出解释
For each test case print the answer modulo $10^9+7$.
输入样例
3 3
1 2 3
-1
3 2 1
输出样例
1
提示
The order in the function series is determined. What she can do is to assign the values to the unknown functions.
来自杭电HDUOJ的附加信息
Author xudyh
Recommend wange2014

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

源链接: HDU-5399

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

共提交 0

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