Problem G. permutation 2

时间限制 1000 ms   内存限制 256 MB

You are given three positive integers $N, x, y$.
Please calculate how many permutations of $1 \sim N$ satisfies the following conditions (We denote the $i$-th number of a permutation by $p_i$):

1. $p_1 = x$

2. $p_N = y$

3. for all $1 \le i <N$, $|p_i - p_{i+1}| \le 2$
 

输入数据

The first line contains one integer $T$ denoting the number of tests.

For each test, there is one line containing three integers $N, x, y$.

* $1 \le T \le 5000$

* $2 \le N \le 10^5$

* $1 \le x < y \le N$
 

输出数据

For each test, output one integer in a single line indicating the answer modulo $998244353$.
 

样例输入

复制
3
4 1 4
4 2 4
100000 514 51144

样例输出

复制
2
1
253604680

提交

请先 登录

© 2025 FAQs Contact About