P5388 [Cnoi2019] Final Fantasy

Background

In theory, the final problem should be a data structure problem, but it got delayed again and again.

Description

You have an $n$-dimensional hypersphere. Find how many $n$-dimensional regions it can be divided into using $k$ $(n-1)$-dimensional hyperplanes. Take the answer modulo $998244353$.

Input Format

Input two numbers $n, k$.

Output Format

One line, the answer.

Explanation/Hint

Subtask 1 (21 pts): $n \le 10^6$. Subtask 2 (7 pts): $k \le n$. Subtask 3 (72 pts): No special restrictions. Constraints: For $100\%$ of the testdata, $n, k \in [1, 998244353)$. Translated by ChatGPT 5