|
||||||||||
permutation 2Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1084 Accepted Submission(s): 629 Problem Description 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$ Input 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$ Output For each test, output one integer in a single line indicating the answer modulo $998244353$. Sample Input
Sample Output
Source | ||||||||||
|