CF2262A1 Floor of MEX (Easy Version)
Description
**This is the easy version of the problem. The difference between the versions is that in this version, you only need to find one subset that satisfies the constraints. You can hack only if you solved all versions of this problem.**
Let
$$f(S,x)=\text{mex}\left(\left\{\left\lfloor \frac{y}{x}\right\rfloor : y\in S\right\}\right), $$
where $ S $ is a set of non-negative integers and $ x $ is a positive integer. $ ^{\text{∗}} $
Farmer John chooses a (possibly empty) subset $ A\subseteq \{0,1,\ldots,n-1\} $ . He then constructs an array $ a $ of length $ n $ , where $ a_k = f(A,k) $ for every $ 1\le k\le n $ .
Bessie, being a mischievous cow, hides the set $ A $ . Farmer John is left only with the array $ a_1,a_2,\ldots,a_n $ .
Your task is to construct any (possibly empty) subset $ B\subseteq \{0,1,\ldots,n-1\} $ such that $ f(B,k)=a_k $ for every $ 1 \le k \le n $ . Farmer John will only give you arrays where such a $ B $ exists.
$ ^{\text{∗}} $ $ \operatorname{mex}(c) $ denotes the minimum excluded (MEX) $ ^{\text{∗}} $ of the collection $ c $ . (in this case, the minimum non-negative integer not present in the set)
Input Format
Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 10^4 $ ). The description of the test cases follows.
The first line of each test case contains a single integer $ n $ ( $ 1 \leq n \leq 10^5 $ ).
The second line of each test case contains $ n $ integers $ a_1,a_2,\ldots,a_n $ ( $ 0 \leq a_i \leq n $ ).
You will only be given arrays where there exists $ B \subseteq \{0,1,\ldots,n-1\} $ such that $ f(B,k)=a_k $ for every $ 1 \le k \le n $ .
It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 10^5 $ .
Output Format
For each test case, output two lines.
On the first line, output an integer $ m $ — the size of the set $ B $ .
On the second line, output $ m $ distinct integers $ b_1,b_2,\ldots,b_m $ — the elements of $ B $ . If $ m=0 $ , the second line should be empty.
The elements of $ B $ may be printed in any order.
If there are multiple solutions, you may output any of them.
Explanation/Hint
For the first test case, one possible answer is
$$$B=\{1,2,3,4,5\}. $$$
Then
$$$f(B,1)=\text{mex}(\{1,2,3,4,5\})=0, $$$
$$$f(B,2)=\text{mex}(\{0,1,2\})=3, $$$
and
$$$f(B,3)=f(B,4)=f(B,5)=2. $$$
Finally,
$$$f(B,6)=\text{mex}(\{0\})=1. $$$
Thus the array is $ [0,3,2,2,2,1] $ .
For the second test case, one possible answer is $$$B=\{0,1\}. $$$
Then $ f(B,1)=2 $ , and for every $ 2\le k\le 5 $ , we have
$$$\left\{\left\lfloor y/k\right\rfloor : y\in B\right\}=\{0\}, $$$
so $ f(B,k)=1 $ . Therefore, the array is $ [2,1,1,1,1] $ .