21712_BoardColoring

2022-5-16 18:20| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505781265400-Problem List-采集的数据-后羿采集器.html

Pro.ID

21712

Title

Board Coloring

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21712

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

  • Time Limit: 16000/8000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    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 :

    1. Ax, yAx, y-1.

    2. For some given pairs of (X1, Y1) (X2, Y2), Ax1, y1 = Ax2, y2

    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, Y2N)

    输出

    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 :

    1. Ax, yAx, y-1.

    2. For some given pairs of (X1, Y1) (X2, Y2), Ax1, y1 = Ax2, y2

    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, Y2N)

    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
    1 0
    1 3
    1 1 2 1
    1 1 3 1
    4 1 3 1
    2 6
    1 1 2 1
    1 1 3 1
    1 1 4 1
    1 2 2 2
    1 2 3 2
    1 2 4 2

    Sample Output

    Case 1: 67296
    Case 2: 00256
    Case 3: 32896

    Source

    样例输入

    3
    1 0
    1 3
    1 1 2 1
    1 1 3 1
    4 1 3 1
    2 6
    1 1 2 1
    1 1 3 1
    1 1 4 1
    1 2 2 2
    1 2 3 2
    1 2 4 2

    样例输出

    Case 1: 67296
    Case 2: 00256
    Case 3: 32896

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部