A9101 | Vasily the Bear and Painting Square
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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$ ( $10^{9}+7$ ).
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$ ( $10^{9}+7$ ).
输入格式
The first line contains two integers $n$ and $k$ , separated by a space ( $0<=n,k<=200$ ).
输出格式
Print exactly one integer — the answer to the problem modulo $1000000007$ ( $10^{9}+7$ ).
输入输出样例
输入 #1
0 0
输出 #1
1
输入 #2
0 1
输出 #2
8
输入 #3
0 2
输出 #3
32
输入 #4
1 1
输出 #4
32
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted