QOJ.ac

QOJ

Time Limit: 0.2 s Memory Limit: 512 MB Total points: 100

#2811. NoM

Statistics

Marcel 最近有了一个新爱好:建造禅意花园。他很快发展出了自己的风格,使用 $2N$ 块石头作为花园的装饰。其中一半石头是绿色的(覆盖着苔藓),并被唯一地编号为 $1$ 到 $N$;另一半是灰色的(上面没有苔藓),同样被唯一地编号为 $1$ 到 $N$。为了建造一个花园,Marcel 会将这些石头按某种顺序排成一条直线,确保任意两块相邻石头之间的距离恰好为 $1$ 英寸。

在评价花园的审美吸引力时,所有的花园都被认为是美丽的。然而,Marcel 对他的花园有一个迷信:如果两块编号相同的石头之间的距离是 $M$ 英寸的倍数,那么这个花园就被认为是 $M$-不吉利的($M$-unlucky),这会带来巨大的不幸,并且会导致创建该花园的人的 Code::Blocks 崩溃。Marcel 绝不会建造这样的花园。自然地,所有其他花园都被认为是 $M$-幸运的($M$-lucky)。

作为他寻求启蒙之旅的一部分,Marcel 打算建造所有可能存在的 $M$-幸运花园。然而,由于他也是一个深谋远虑且组织严密的人,Marcel 想在踏上旅程之前知道总共有多少个由 $2N$ 块石头组成的 $M$-幸运花园。如果存在一个整数 $i$,$1 \le i \le 2N$,使得以下条件之一成立,则认为花园 $A$ 和花园 $B$ 是不同的:

  • 花园 $A$ 中第 $i$ 块石头的颜色与花园 $B$ 中第 $i$ 块石头的颜色不同,或者
  • 花园 $A$ 中第 $i$ 块石头的编号与花园 $B$ 中第 $i$ 块石头的编号不同。

输入格式

输入的第一行也是唯一一行包含两个整数 $N$ 和 $M$,表示 Marcel 将要建造由 $2N$ 块石头组成的 $M$-幸运花园。

输出格式

在一行中输出包含 $2N$ 块石头的 $M$-幸运花园的数量,结果对 $10^9 + 7$ 取模。

数据范围

  • $1 \le M \le N \le 2\,000$
# 分值 数据范围
1 9 $1 \le N, M \le 5$
2 12 $1 \le N, M \le 100$
3 13 $1 \le N, M \le 300$
4 18 $1 \le N, M \le 900$
5 48 无附加限制

样例

样例输入 1

100 23

样例输出 1

171243255

样例输入 2

1 1

样例输出 2

0

说明

在第二个样例中,可以建造出两个花园。然而,没有一个是 1-幸运的,因为对于这两个花园,编号为 1 的两块石头之间的距离都是 1 英寸,而 1 是 $M = 1$ 的倍数。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.