QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100 Difficulty: [show]

#54. 小孩召开法

統計
小孩召开法,

旦写一北砬。

梦厷停留在,

破了大式様。

——龚诗锋《炄勺,砒》

小弟递给神树大人一本《阿 Q 外教你学计数》,神树大人看了看第一题,发现不会;神树大人看了看第二题,发现题都读不懂;......;神树大人看了看第 $114514$ 题,终于用 $1919810$ 秒把它做了出来。他决定把这个题写进《神树大人教你做数学》。

对于长为 $n$ 的一个排列 $\{a_i\}$ 的一个子序列 $a_{i_1},a_{i_2},\dots a_{i_k}$,如果这个子序列满足 $a_{i_1} >a_{i_2} < a_{i_3}\dots >a_{i_k}$,那么这个子序列被称作交替子序列。你要求的就是最长的交替子序列等于 $K$ 的长为 $n$ 的排列有多少个,对 $998244353$ 取模。

输入格式

输入只有一行,包含两个整数 $n,K$。

输出格式

输出一行一个整数,表示答案。

样例数据

样例 1 输入

3 2

样例 1 输出

3

样例 1 解释

序列 $[1, 3, 2], [2, 3, 1], [3, 2, 1]$ 符合要求。

样例 2 输入

10 6

样例 2 输出

878856

样例 3 输入

5000 1145

样例 3 输出

849619090

子任务

提示:龚诗锋,小万邦,小弟是一个人。

另注:千万不要在这道题上浪费太多时间。

子任务 分数 $n$ $K$
$1$ $10$ $\leq 10$ $\leq n$
$2$ $20$ $\leq 5000$
$3$ $5$ $\leq 10^5$ $=n$
$4$ $10$ $\leq n$
$5$ $15$ $\leq 10^9$ $\leq \min(20,n)$
$6$ $5$ $\leq \min(200,n)$
$7$ $35$ $\leq 10^{18}$ $\leq \min(10^6,n)$
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.