#P4152. [WC2014] 时空穿梭
[WC2014] 时空穿梭
Description
Xiao X is piloting his spaceship to traverse an -dimensional space, where each point is represented by real numbers, i.e., .
To pass through this space, Xiao X needs to choose () points in this space as stopping places for the spaceship, and these points must satisfy the following three conditions:
- Every coordinate of each point is a positive integer, and the -th coordinate does not exceed .
- For and , the -th coordinate of the -th point must be strictly greater than the -th coordinate of the -th point.
- There exists a straight line passing through all the chosen points. In this -dimensional space, a straight line can be represented by real numbers , , … , , , , … , . A line passes through a point if and only if there exists a real number such that for it holds that = .
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 .
Input Format
The first line contains a positive integer , the number of test cases.
For each test case, there are two lines:
- The first line contains two positive integers , (), denoting the dimension of the space and the number of stopping points to select.
- The second line contains positive integers, which are , , … , .
Output Format
Output 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 , , ; the other is to choose , , .
Constraints

Translated by ChatGPT 5
京公网安备 11011102002149号