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

建议使用的浏览器:

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

6952:Puzzle loop

题目描述
Given a grid with n*m grid points and (n-1)*(m-1) blocks. There may be a number of 0 or 1 in some block, represents the number of lines surround this block is odd or even.(0 for even and 1 for odd) When there is no number, there is no limit to the number of lines surround this block.

You have to draw lines between the grid points to form several cycles (a cycle in the grid is a non-empty trail in which the only repeated grid points are the first and last grid points). Two cycles can share grid points but can not share lines.

Please find the number of different solution modulo 998244353. When a line exists in one solution and does not exist in the other solution, the two solutions are considered different.

输入解释
The first line contains a single integer t (t<=100) representing the number of test cases in the input. Then t test cases follow.

The first line of each test case contains two integers n and m (2<=n,m<=17) representing the height and width of the grid.

Then n-1 lines followed. The i-th of these lines contains m-1 integers, representing the number in the grid. If there is no number, use '.' instead.

The number of test witch n, m>=10 does not exceed 5.
输出解释
For each test case, print one integer in one line, which is the answer modulo 998244353.
输入样例
2
3 3
01
1.
3 4
111
1..
输出样例
4
4

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

源链接: HDU-6952

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

共提交 0

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