Hard Problem

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

You are given an integer array a_1,,a_na\_1, \ldots, a\_n. A subsegment of even length a_i,,a_i+2m1a\_i,\ldots, a\_{i + 2m - 1} is called good if max(a_i,,a_i+m1)max(a_i+m,,a_i+2m1)k\left|\max(a\_i,\dots, a\_{i + m - 1}) - \max(a\_{i + m}, \ldots, a\_{i + 2m - 1})\right| \leq k.

Let us define an integer sequence ff as follows:

  • f_1=3240f\_1 = 3240
  • f_2=3081f\_2 = 3081
  • f_3=2841f\_3 = 2841
  • f_4=343f\_4 = 343
  • f_i=f_i1223+f_i2229+f_i3f_i4239+17f\_i = f\_{i-1} \cdot 223 + f\_{i-2} \cdot 229 + f\_{i-3} \cdot f\_{i-4} \cdot 239 + 17 for i>4i > 4

Calculate the sum (a_i+m1+10)f_m(a\_{i+m-1} + 10) \cdot f\_{m} among all good subsegments. Since this number can be large, print it modulo 998,244,353998\\,244\\,353.

입력

The first line contains a single integer tt (1t1041 \leq t \leq 10^4) --- the number of test cases. Description of test cases follows.

The first line of each test case contains two integers nn, kk (1n51051 \leq n \leq 5 \cdot 10^5, 0kmin(n,10)0 \leq k \leq \min (n, 10)).

The next line contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (1a_in1 \leq a\_i \leq n).

It is guaranteed that the sum of nn for all test cases does not exceed 51055 \cdot 10^5.

출력

For each test case, print a single integer --- the answer to the problem.