|
||||||||||
Shattrath CityTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 379 Accepted Submission(s): 126 Problem Description $\space \space$**Why would a *prophet* not warn of calamity?* $\space \space$**Why didn't you warn the world about the Cataclysm?* The simple, logical question of a mortal child echoed accusingly throughout the silent chamber, distracting the Prophet from his contemplation of the Light. Velen had evaded rather than answered, obscured instead of illuminating. He was surprised at himself. *Am I still capable of deception? Even after all this time? Both within and without?* $\space \space$**Velen is sinking in self-doubt.* Velen calls a sequence "$n$-beautiful", if it satisfies the following three conditions: 1. Its length is larger than $n$. 2. Each element of the sequence is a positive integer $\leq n$. 3. Each of its **continuous** subsequence of length $n$ is **NOT** a permutation of $1,2...n$. Velen takes inspiration from "$n$-beautiful" sequences, so he is interested in the number of "$n$-beautiful" sequences of length $m$. Could you help him? Since the answer can be very large, you only need to output the answer **modulo 998244353**. Input The input consists of multiple test cases. The first line contains an integer $T (1\leq T \leq 4)$ denoting the number of test cases. Each test case consists of only one line containing two integers $n,m\ (3\leq n < m \leq 2\times 10^5)$. Output For each test case, output one line containing one integer indicating the answer. Sample Input
Sample Output
Source | ||||||||||
|