Sequence 3

AtCoder
IDfps_24_e
Time2000ms
Memory256MB
Difficulty
Consider integer sequences $A = (a_1,a_2,\dots,a_N)$ of length $N$, where each element is a positive integer not greater than $M$. Count how many such sequences satisfy the following condition, and output the result modulo $998244353$. * For every integer $m$ such that $1 \leq m \leq M$, the number of times $m$ appears in $A$ is at most $m$. ## Constraints * $1 \leq N \leq 300$ * $1 \leq M \leq 300$ * $N, M$ are integers ## Input The input is given from standard input in the following format: $N$ $M$ [samples]
Samples
Input #1
2 3
Output #1
8

There are $8$ sequences that satisfy the condition:

*   $(1, 2)$
*   $(1, 3)$
*   $(2, 1)$
*   $(2, 2)$
*   $(2, 3)$
*   $(3, 1)$
*   $(3, 2)$
*   $(3, 3)$
Input #2
300 300
Output #2
478329414
API Response (JSON)
{
  "problem": {
    "name": "Sequence 3",
    "description": {
      "content": "Consider integer sequences $A = (a_1,a_2,\\dots,a_N)$ of length $N$, where each element is a positive integer not greater than $M$.   Count how many such sequences satisfy the following condition, and ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "fps_24_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Consider integer sequences $A = (a_1,a_2,\\dots,a_N)$ of length $N$, where each element is a positive integer not greater than $M$.  \nCount how many such sequences satisfy the following condition, and ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments