CF336E.Vasily the Bear and Painting Square

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasily the bear has two favorite integers n and k and a pencil. Besides, he's got k jars with different water color paints. All jars are numbered in some manner from 1 to k, inclusive. The jar number i contains the paint of the i-th color.

Initially the bear took a pencil and drew four segments on the coordinate plane. All of them end at point (0, 0). They begin at: (0, 2_n_), (0,  - 2_n_), (2_n_, 0), ( - 2_n_, 0). Then for each i = 1, 2, ..., n, the bear drew two squares. The first square has the following vertex coordinates: (2_i_, 0), ( - 2_i_, 0), (0,  - 2_i_), (0, 2_i_). The second square has the following vertex coordinates: ( - 2_i_ - 1,  - 2_i_ - 1), ( - 2_i_ - 1, 2_i_ - 1), (2_i_ - 1,  - 2_i_ - 1), (2_i_ - 1, 2_i_ - 1). After that, the bear drew another square: (1, 0), ( - 1, 0), (0,  - 1), (0, 1). All points mentioned above form the set of points A.

The sample of the final picture at n = 0

The sample of the final picture at n = 2

The bear decided to paint the resulting picture in k moves. The i-th move consists of the following stages:

  1. The bear chooses 3 distinct points in set А so that any pair of the chosen points has a segment on the picture between them. The chosen points and segments mark the area that mustn't contain any previously painted points.
  2. The bear paints the area bounded by the chosen points and segments the i-th color.

Note that after the k-th move some parts of the picture can stay unpainted.

The bear asked you to calculate, how many distinct ways there are to paint his picture. A way to paint the picture is a sequence of three-element sets of points he chose on each step. Two sequences are considered distinct if there is such number i (1 ≤ i ≤ k), that the i-th members of these sequences do not coincide as sets. As the sought number can be rather large, you only need to calculate the remainder after dividing it by number 1000000007 (109 + 7).

瓦西里熊有两个最喜爱的整数 nn 和 kk,以及一支铅笔。此外,他还有 kk 个装有不同水彩颜料的颜料罐。所有颜料罐以某种方式编号,编号从 11 到 kk(含端点)。编号为 ii 的颜料罐中装有第 ii 种颜色的颜料。

最初,熊用铅笔在坐标平面上画了四条线段,它们均终止于点 (0, 0)(0,\,0),起点分别为:(0, 2n)(0,\,2^n)、(0, −2n)(0,\,-2^n)、(2n, 0)(2^n,\,0)、(−2n, 0)(-2^n,\,0)。接着,对每个 i=1, 2, …, ni = 1,\,2,\,\dots,\,n,熊画了两个正方形:

  • 第一个正方形的四个顶点坐标为:(2i, 0)(2^i,\,0)、(−2i, 0)(-2^i,\,0)、(0, −2i)(0,\,-2^i)、(0, 2i)(0,\,2^i);
  • 第二个正方形的四个顶点坐标为:(−2i−1, −2i−1)(-2^{i-1},\,-2^{i-1})、(−2i−1, 2i−1)(-2^{i-1},\,2^{i-1})、(2i−1, −2i−1)(2^{i-1},\,-2^{i-1})、(2i−1, 2i−1)(2^{i-1},\,2^{i-1})。

之后,熊又画了一个正方形:(1, 0)(1,\,0)、(−1, 0)(-1,\,0)、(0, −1)(0,\,-1)、(0, 1)(0,\,1)。上述所有提到的点构成了点集 AA。

n=0n = 0 时最终图形的示例

n=2n = 2 时最终图形的示例

熊决定用 kk 步完成该图形的涂色。第 ii 步包含以下阶段:

  1. 熊从点集 AA 中选出三个互不相同的点,使得任意两点之间在图中都存在一条线段连接。所选的点及这些线段围成的区域中,不能包含任何先前已涂色的点;
  2. 熊将该由所选三点及对应线段围成的区域涂上第 ii 种颜色。

注意:经过 kk 步后,图形中某些部分可能仍未被涂色。

熊请你计算:共有多少种不同的涂色方式?一种涂色方式定义为每一步所选三点构成的三元点集所组成的序列。若存在某个序号 ii(1≤i≤k1 \le i \le k),使得两个序列的第 ii 个三元点集作为集合不相同,则认为这两个序列不同。由于答案可能非常大,你只需输出其对 10000000071000000007(即 109+710^9 + 7)取模的结果。

输入格式

The first line contains two integers n and k, separated by a space (0 ≤ n, k ≤ 200).

第一行包含两个整数 nn 和 kk,以空格分隔(0 ≤ n, k ≤ 2000 ≤ n, k ≤ 200)。

输出格式

Print exactly one integer — the answer to the problem modulo 1000000007 (109 + 7).

输出一个整数——该问题答案对 10000000071000000007(即 109+710^9 + 7)取模的结果。

输入输出样例

  • 输入#1

    0 0

    输出#1

    1
  • 输入#2

    0 1

    输出#2

    8
  • 输入#3

    0 2

    输出#3

    32
  • 输入#4

    1 1

    输出#4

    32

输入解题思路,AI测评打分。不知道怎么写?

首页