第 228 场 AtCoder Regular Contest++
E
排列对
Pair of Permutations
AtCoder
⌀ 3835
原题
← D→

排列对AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

Find the number, modulo $998244353$, of pairs of permutations $(P,Q)=((P_1,P_2,\dots,P_N),(Q_1,Q_2,\dots,Q_N))$ of $(1,2,\dots,N)$ satisfying the following condition.

求满足以下条件的 $(1,2,\dots,N)$ 的排列对 $(P,Q)=((P_1,P_2,\dots,P_N),(Q_1,Q_2,\dots,Q_N))$ 的数量,结果对 $998244353$ 取模。AI (CI翻译)

  • $P_i \le i+M$, $Q_i \le i+M$, and $P_i \neq Q_i$ all hold for every integer $i$ satisfying $1 \le i \le N$.
  • 对于满足 $1 \le i \le N$ 的每个整数 $i$,均有 $P_i \le i+M$、$Q_i \le i+M$ 且 $P_i \neq Q_i$。
AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $2 \le N \le 10^9$
  • $1 \le M \le 125000$
  • All input values are integers.
  • $2 \le N \le 10^9$
  • $1 \le M \le 125000$
  • 所有输入值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入中按以下格式给出:AI (CI翻译)

N M

N M
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output the answer.

输出答案。AI (CI翻译)

样例

Input #1
3 1
Output #1
4
The pairs $(P,Q)$ satisfying the condition are the following four pairs. - $P = (1,2,3),Q = (2,3,1)$ - $P = (1,3,2),Q = (2,1,3)$ - $P = (2,3,1),Q = (1,2,3)$ - $P = (2,1,3),Q = (1,3,2)$
Input #2
7 3
Output #2
644544
Input #3
1000000000 125000
Output #3
357543611
题目信息
题号
arc228_e
时间限制
8 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。