| Codeforces Round 1135 (Div. 2) |
|---|
| Finished |
You are given an array $$$a$$$ of length $$$n$$$. In one operation, you may replace the unique largest element in $$$a$$$ with any strictly smaller positive integer (i.e., any integer $$$x$$$ such that $$$1 \le x \lt \max(a)$$$). You can only perform this operation if $$$a$$$ has a unique largest element.
Determine the number of distinct$$$^{\text{∗}}$$$ arrays that can be obtained by performing the operation any number of times (possibly zero). Since the answer may be large, output it modulo $$$10^9+7$$$.
$$$^{\text{∗}}$$$Two arrays $$$a$$$ and $$$b$$$ are considered distinct if they differ in at least one position, i.e., there exists an index $$$i$$$ such that $$$a_i \ne b_i$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 1000$$$). The description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the array.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot 10^5$$$.
For each test case, output a line with a single integer — the number of distinct arrays that can be obtained by performing the operation any number of times, modulo $$$10^9+7$$$.
532 2 121000000000 146 7 2 233 4 211
110000000003291
In the first test case, since the maximum element $$$2$$$ is not unique, the only array that can be obtained is $$$[2,2,1]$$$ — the initial array.
In the second test case, the maximum element is $$$1\,000\,000\,000$$$. It can be shown that after any number of operations, the possible arrays are $$$[1,1], [2,1], [3,1], \ldots [1\,000\,000\,000,1]$$$. Hence the answer is $$$1\,000\,000\,000$$$.
| Name |
|---|


