Count the Arrays

TimeLimit:2000MS  MemoryLimit:512MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

Your task is to calculate the number of arrays such that:


1、each array contains n elements;

2、each element is an integer from 1 to m;

3、for each array, there is exactly one pair of equal elements;

for each array a, there exists an index i such that the array is strictly ascending before the i-th element and strictly descending after it (formally, it means that aj<aj+1, if j<i, and aj>aj+1, if j≥i).


Input

The first line contains two integers n and m (2≤n≤m≤2⋅10^5).

Output

Print one integer — the number of arrays that meet all of the aforementioned conditions, taken modulo 998244353.

SampleInput 1
3 4
SampleOutput 1
6
SampleInput 2
3 5
SampleOutput 2
10
SampleInput 3
42 1337
SampleOutput 3
806066790
SampleInput 4
100000 200000
SampleOutput 4
707899035
Note

The arrays in the first example are:

  • $$$[1, 2, 1]$$$;
  • $$$[1, 3, 1]$$$;
  • $$$[1, 4, 1]$$$;
  • $$$[2, 3, 2]$$$;
  • $$$[2, 4, 2]$$$;
  • $$$[3, 4, 3]$$$.
Submit
题目统计信息详细
总AC数4
通过人数4
尝试人数5
总提交量5
AC率80.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: