CF1188C.Array Beauty

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let's call beauty of an array b1,b2,,bnb_1, b_2, \ldots, b_n ( n>1n > 1 ) — min1i<jnbibj\min\limits_{1 \leq i < j \leq n} |b_i - b_j| .

You're given an array a1,a2,ana_1, a_2, \ldots a_n and a number kk . Calculate the sum of beauty over all subsequences of the array of length exactly kk . As this number can be very large, output it modulo 998244353998244353 .

A sequence aa is a subsequence of an array bb if aa can be obtained from bb by deletion of several (possibly, zero or all) elements.

输入格式

The first line contains integers n,kn, k ( 2kn10002 \le k \le n \le 1000 ).

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n ( 0ai1050 \le a_i \le 10^5 ).

输出格式

Output one integer — the sum of beauty over all subsequences of the array of length exactly kk . As this number can be very large, output it modulo 998244353998244353 .

输入输出样例

  • 输入#1

    4 3
    1 7 3 5
    

    输出#1

    8
  • 输入#2

    5 5
    1 10 100 1000 10000
    

    输出#2

    9

说明/提示

In the first example, there are 44 subsequences of length 33[1,7,3][1, 7, 3] , [1,3,5][1, 3, 5] , [7,3,5][7, 3, 5] , [1,7,5][1, 7, 5] , each of which has beauty 22 , so answer is 88 .

In the second example, there is only one subsequence of length 55 — the whole array, which has the beauty equal to 101=9|10-1| = 9 .

首页