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

建议使用的浏览器:

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

7065:Yinyang

题目描述
You have a grid of $n$ rows and $m$ columns, each cell should be painted either black or white.
The cell in the $i$th row and $j$th column is denoted as $(i,j)$.
Two cells are $directly$ $connected$ if and only if they have a common edge and have the same color.
Two cells are $connected$ if and only if they are $directly$ $connected$ or there exist a cell $connected$ to both cells.
A painting plan is $good$ if and only if it satisfy three conditions:
1. All white cells are $connected$
2. All black cells are $connected$
3. $\forall 1 \leq i < n,1 \leq j < m$, cell$(i,j)$,$(i,j+1)$,$(i+1,j)$and$(i+1,j+1)$ can't have the same color.
Some of the cells have been painted, you should paint the rest .
output the number of $good$ painting plans module $998244353$.
输入解释
The first line of input contains an integer $T(T \leq 10)$, denoting the number of test cases.
Each test case contains $n+1$ lines.
The first line contains two integer $n, m(3 \leq n \leq 100,3 \leq m \leq 100, n*m<=100)$, denoting the size of the grid.
The next $n$ lines describe the painted cells, each line contains $m$ integer.
The $j$th number in $i$th row describe cell$(i,j)$,the number is $0$,$1$ or $-1$.
$0$ means the cell is painted white,$1$ means the cell is painted black, $-1$ means the cell is not painted.
输出解释
Output the number of $good$ painting plans module $998244353$.
输入样例
3
3 3
1 0 0
1 1 0
-1 -1 0
3 4
1 -1 -1 0
-1 -1 -1 -1
0 -1 -1 1
10 10
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
输出样例
2
0
139719073

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

源链接: HDU-7065

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

共提交 0

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