F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Matryoshka Doll

Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 827    Accepted Submission(s): 458


Problem Description
<tt>zyb</tt> bought $n$ matryoshka dolls during his visit to Moscow, with sizes $a_1,a_2,\dots,a_n$, respectively, <strong>sorting from smallest to largest</strong>.

A matryoshka of size $i$ can be put into another matryoshka of size $j$ if and only if $j-i\geq r$, where $r$ is some given integer parameter.

<tt>zyb</tt> wishes to divide all $n$ matryoshka dolls into $k$ groups, such that one can form a <strong>nested</strong> matryoshka doll in each group, where a group of matryoshka dolls with indices $c_1,c_2,...,c_m$ ($1\leq c_1\lt c_2\lt ...\lt c_m \leq n$) can form a <strong>nested</strong> matryoshka doll iff $\forall 1\leq i\lt m, a_{c_i}+r\leq a_{c_{i+1}}$.

<tt>zyb</tt> wants to know how many ways there are to divide the $n$ dolls into $k$ groups satisfying the requirement above. Note that divisions such as $\{ \{ 1,2\} ,\{ 3,4\} \}$ and $\{ \{ 3,4\} ,\{ 1,2\} \}$ are considered the same way. As the answer may be too large, you only need to output the answer modulo $998244353$.
 

Input
The first line contains an integer $T(1\leq T\leq 20)$, denoting the number of test cases.

For each test case, the first line contains three integers $n,k,r(1\leq k\leq n\leq 5000, 1\leq r\leq 10^9)$, denoting the number of matryoshka dolls, the number of groups <tt>zyb</tt> wants to divide into, and the parameter, respectively.

The next line contains $n$ integers $a_1,a_2,\dots,a_n(1\leq a_1\leq a_2\leq ... \leq a_n\leq 10^9)$, denoting the sizes of the matryoshka dolls.

It is guaranteed that $\sum n\leq 50000$ over all test cases.
 

Output
For each test case, output an integer in a line, denoting the answer taken modulo $998244353$.
 

Sample Input
2 4 3 2 1 2 3 4 4 2 1 1 1 2 2
 

Sample Output
3 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-10 18:19:29, Gzip enabled