EPIC Institute of Technology Round August 2024 (Div. 1 + Div. 2)
H
Counting 101
Codeforces
3500
原题
← G→
翻译中…

It's been a long summer's day, with the constant chirping of cicadas and the heat which never seemed to end. Finally, it has drawn to a close. The showdown has passed, the gates are open, and only a gentle breeze is left behind.

翻译中…

Your predecessors had taken their final bow; it's your turn to take the stage.

翻译中…

Sorting through some notes that were left behind, you found a curious statement named Problem 101:

翻译中…
  • Given a positive integer sequence $a_1,a_2,\ldots,a_n$, you can operate on it any number of times. In an operation, you choose three consecutive elements $a_i,a_{i+1},a_{i+2}$, and merge them into one element $\max(a_i+1,a_{i+1},a_{i+2}+1)$. Please calculate the maximum number of operations you can do without creating an element greater than $m$.
翻译中…

After some thought, you decided to propose the following problem, named Counting 101:

翻译中…
  • Given $n$ and $m$. For each $k=0,1,\ldots,\left\lfloor\frac{n-1}{2}\right\rfloor$, please find the number of integer sequences $a_1,a_2,\ldots,a_n$ with elements in $[1, m]$, such that when used as input for Problem 101, the answer is $k$. As the answer can be very large, please print it modulo $10^9+7$.
翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\le t\le10^3$). The description of the test cases follows.

翻译中…

The only line of each test case contains two integers $n$, $m$ ($1\le n\le 130$, $1\le m\le 30$).

翻译中…

Output

翻译中…

For each test case, output $\left\lfloor\frac{n+1}{2}\right\rfloor$ numbers. The $i$-th number is the number of valid sequences such that when used as input for Problem 101, the answer is $i-1$, modulo $10^9+7$.

翻译中…

Note

翻译中…

In the first test case, there are $2^3=8$ candidate sequences. Among them, you can operate on $[1,2,1]$ and $[1,1,1]$ once; you cannot operate on the other $6$ sequences.

翻译中…

样例

Input #1
2
3 2
10 10
Output #1
6 2
1590121 23399118 382293180 213020758 379696760
InputCopy OutputCopy
题目信息
题号
2002H
时间限制
10.1 s
内存限制
1010 MB
标签
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。