Problem 3016 --permutation 2

3016: permutation 2

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $1$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
You are given three positive integers N,x,yN,x,y
Please calculate how many permutations of 1∼N1∼N satisfies the following conditions (We denote the ii-th number of a permutation by pipi): 

1. p1=xp1=x 

2. pN=ypN=y 

3. for all 1≤i<N1≤i<N|pi−pi+1|≤2
The first line contains one integer TT denoting the number of tests. 

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

1≤T≤50001≤T≤5000 

2≤N≤1052≤N≤105 

1≤x<y≤N
For each test, output one integer in a single line indicating the answer modulo 998244353998244353.
3
4 1 4
4 2 4
100000 514 51144
2
1
253604680

推荐代码 查看3016 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$9 $ms] 淡意的温柔 590723 2020-06-05 09:02:52
内存最少[$2476 $KB] 淡意的温柔 590723 2020-06-05 09:02:52
第一AC 淡意的温柔 590723 2020-06-05 09:02:52
第一挑战 淡意的温柔 590723 2020-06-05 09:02:52

赛题来源/所属竞赛 2019 Multi-University Training Contest 5 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛