#P4152. [WC2014] 时空穿梭

    ID: 3089 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2014WC/CTSC/集训队莫比乌斯反演组合数学

[WC2014] 时空穿梭

Description

Xiao X is piloting his spaceship to traverse an nn-dimensional space, where each point is represented by nn real numbers, i.e., (x1,x2,,xn)(x_1, x_2, \dots, x_n).

To pass through this space, Xiao X needs to choose cc (c2c \geq 2) points in this space as stopping places for the spaceship, and these points must satisfy the following three conditions:

  1. Every coordinate of each point is a positive integer, and the ii-th coordinate does not exceed mim_i.
  2. For 1i<c1 \leq i < c and 1jn1 \leq j \leq n, the jj-th coordinate of the (i+1)(i+1)-th point must be strictly greater than the jj-th coordinate of the ii-th point.
  3. There exists a straight line passing through all the chosen points. In this nn-dimensional space, a straight line can be represented by 2n2n real numbers p1p_1, p2p_2, … , pnp_n, v1v_1, v2v_2, … , vnv_n. A line passes through a point (x1,x2,,xn)(x_1, x_2, \dots, x_n) if and only if there exists a real number tt such that for i=1ni = 1 \dots n it holds that xix_i = pi+tvip_i + tv_i.

Xiao X has not finalized his plan yet. Please help him compute how many different schemes satisfy his requirements. Since the answer may be very large, you only need to output the value of the answer mod 1000710 007.

Input Format

The first line contains a positive integer TT, the number of test cases.

For each test case, there are two lines:

  • The first line contains two positive integers nn, cc (c2c \geq 2), denoting the dimension of the space and the number of stopping points to select.
  • The second line contains nn positive integers, which are m1m_1, m2m_2, … , mnm_n.

Output Format

Output TT lines. Each line contains a non-negative integer, which is the answer for the corresponding test case.

3
2 3
3 4
3 3
3 4 4
4 4
5 9 7 8
2
4
846
1
11 20
97665 99289 91440 92389 93960 94623 96582 93975 98359 93492 90331

3278

Hint

[Sample 1 Explanation]

There are two feasible schemes in the first sample: one is to choose (1,1)(1,1), (2,2)(2,2), (3,3)(3,3); the other is to choose (1,2)(1,2), (2,3)(2,3), (3,4)(3,4).

Constraints

Translated by ChatGPT 5