Count Multiset

AtCoder
IDabc221_h
Time2000ms
Memory256MB
Difficulty
Given are positive integers $N$ and $M$. For each $k=1,2,\ldots,N$, find the following number and print it modulo $998244353$. * The number of multisets $A$ containing $k$ positive integers that satisfy both of the following conditions: * the sum of the elements of $A$ is $N$; * for every positive integer $x$, $A$ contains at most $M$ occurrences of $x$. ## Constraints * $1 \leq M \leq N \leq 5000$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $N$ $M$ [samples]
Samples
Input #1
4 2
Output #1
1
2
1
0

*   For $k=1$, there is one multiset $A$ that satisfies the conditions: ${4}$.
*   For $k=2$, there are two multisets $A$ that satisfy the conditions: ${1,3}$ and ${2,2}$.
*   For $k=3$, there is one multiset $A$ that satisfies the conditions: ${1,1,2}$.
*   For $k=4$, there is no multiset $A$ that satisfies the conditions.
Input #2
7 7
Output #2
1
3
4
3
2
1
1
API Response (JSON)
{
  "problem": {
    "name": "Count Multiset",
    "description": {
      "content": "Given are positive integers $N$ and $M$. For each $k=1,2,\\ldots,N$, find the following number and print it modulo $998244353$. *   The number of multisets $A$ containing $k$ positive integers that sa",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc221_h"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given are positive integers $N$ and $M$.\nFor each $k=1,2,\\ldots,N$, find the following number and print it modulo $998244353$.\n\n*   The number of multisets $A$ containing $k$ positive integers that sa...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments