Pro.ID21712 TitleBoard Coloring Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21712 AC1 Submit1 Ratio100.00% 时间&空间限制描述HH is painting a board of size 4 × N. You can assume the color of square (X, Y) on the board is Ax, y which is an integer between 0 and 255. For the beauty of the board, HH decide to paint the board following the rules :
Your task is to calculate how many ways there are to paint the board. 输入There are multiple test cases, the first line of input contains a single integer denoting the number of test cases. For each test case, the first line contains an integer N and M, denoting the length of the board and the number of additional rules. (1 ≤ N ≤ 15, 0 ≤ M ≤ 100) For next M lines, each line contains four integers X1, Y1, X2, Y2 denoting one additional rule for the painting. (1 ≤ X1, X2 ≤ 4, 1 ≤ Y1, Y2 ≤ N) 输出Description HH is painting a board of size 4 × N. You can assume the color of square (X, Y) on the board is Ax, y which is an integer between 0 and 255. For the beauty of the board, HH decide to paint the board following the rules :
Your task is to calculate how many ways there are to paint the board. Input There are multiple test cases, the first line of input contains a single integer denoting the number of test cases. For each test case, the first line contains an integer N and M, denoting the length of the board and the number of additional rules. (1 ≤ N ≤ 15, 0 ≤ M ≤ 100) For next M lines, each line contains four integers X1, Y1, X2, Y2 denoting one additional rule for the painting. (1 ≤ X1, X2 ≤ 4, 1 ≤ Y1, Y2 ≤ N) Output For each test cases, you are to output the number of ways of painting. Because there may be too many ways, you are only to output the last five digits. See sample output for further details. Sample Input 3 Sample Output Case 1: 67296 Source 样例输入3 样例输出Case 1: 67296 作者 |