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

建议使用的浏览器:

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

6234:Square Network

题目描述
Alice and Bob are extremely happy recently. Because the school assigns a new machine room to their lab. They are in charge of setting up a group of servers. In the room, there are $N \times N$ blanks to put servers. Alice wants the arrangement of servers to be elegant, so she thinks that some blanks must be empty, while others must not be empty. According to the need of lab, Bob is planning to purchase $K$ types of severs. Moreover, he gives $T$ groups of blanks, where one blank might be contained in different groups. Each group has exactly $K$ blanks, and any two of servers in the blanks of one group must not be the same type. Now, some servers has been put in some blank, which can not be changed. With all these conditions, Alice and Bob want to know how many ways that they can arrange the machine room.
输入解释
The first line is the number of test cases.
For each test case, the first line consists of three integers $N$, $K$, and $T (N, K \leq 6, T\leq 12)$.
In the next $N$ lines, each line consists of $N$ integers $A_{i, j}$.If $A_{i, j} = -1$, the blank $(i, j)$ must be empty. If $A_{i, j} = 0$, a server is require to put on this blank. Otherwise, a server of type $A_{i, j}$ is on this blank.
In the next $T$ lines, each line consists of $K$ pair of integers. Each pair of integers donate the coordinate of blank in this group.
输出解释
For each test case, output an integer donating the ways that Alice and Bob can arrange the room. If the solution is larger than $20172017$, output `TOO MANY`.
输入样例
2
3 3 4
0 0 1
0 -1 0
0 0 0
1 1 1 2 1 3
1 1 2 1 3 1
1 3 2 3 3 3
3 1 3 2 3 3
5 5 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
输出样例
6
TOO MANY
来自杭电HDUOJ的附加信息
Recommend jiangzijing2015

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

源链接: HDU-6234

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

共提交 0

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