Another advice: I guess that rested domino must form graph with next specific: It must be reduced to empty by sequental removing of vertex with degree=1 and adjacent with one. ("должен общипываться").What kind of these graphs?
Dominos are usually solved by finding perfect bipartie matching between odd and even cells (for their x+y). Now the problem is to fix minimal number of matched edges, so that maximum matching over remaining graph is unique. If there is alternating cycle, then matching is not unique.
What algo could we design based on it? 1. Find all cycles. 2. For each edge form set of all circles containig it. 3. Find minimal covering of set of all circles. Shortly, we should use minimal covering problem?
First,I think it might use "Bit DP" to solve this problem.But I failed Second,I think it might have a method to make a solution for given N,M .But I can't find this method. Last,I want to calculate all the case because N and M is very small.But I can't decide whether it is the best solution for each case. I have no idea for this problem.Could you please tell me how to solve this problem?Thank you. By the way,I'm sorry for my poor English.I wish you could know what I say.