Responsive image

问题 1848 --WrongStatement

1848: WrongStatement

时间限制: 2 Sec  内存限制: 128 MB
提交: 1  解决: 0
[提交][状态][讨论版][命题人:]

题目描述

The board is a rectangle of unit grids with N rows and M columns.
There are infinity 1×2 and 2×1 dominoes.
Some grids are broken, so they are removed, marked with 'X' character.
It is pressure to place dominoes in the board as many as possible.
But sometimes there may be one grid unfilled no matter how you place them.
The board has only one special gird marked with '@'. This special grid can place domino, but should be empty when you finish placement.
It is a pity that the only empty grid is marked with '.' when you finish placement.
You have chance to move the dominoes.The domino can be moved when the short edge is adjacent to the blank grid. The domino will move horizontally or vertically one grid. You can move the domino as many times as you want. Now, the question is how many initial placement can be adjust 
with movement to the final state which means every droppable grid except '@' grid, marked with '.', should be filled with domino, and the '@' grid empty.

输入描述

The first line of the input gives the number of test cases T; T test cases follow.
Each case begins with one line with two integers N and M : the number of rows and columns in the grid.
The N lines of M characters each follow; each character is '.', 'X' or '@', as described in the statement.
Limits
T≤100
1≤N,M≤8
Each character in the grid is one of '.', 'X' or '@'.
'@' will appear exactly once;

输出描述

For each test case output one integer denotes the answer.
As for the answer may be too large, you should output it modulo 1000000007 (109+7).
 

样例输入

3
3 5
....X
.@...
...X.
3 5
.....
.@...
.....
3 3
...
...
..@

样例输出

4
10
16

来源

 

[提交][状态]
ACM算法攻关部
  • Anything about this OnlineJudge, Please Contact Administrator. Click add QQ

    OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap

    Copyright 2016 ACM算法攻关部
    关于网站改版