AT_arc215_b [ARC215B] Stolen Necklace
Description
There are $ 2N $ gems arranged in a row from left to right, and the type of the $ i $ -th gem from the left is $ A_i $ . Here, $ A_i $ is an integer between $ 1 $ and $ N $ , inclusive, and there are exactly two gems of each type.
You want to insert dividers satisfying the following conditions.
- Each divider's position is represented by an integer $ i $ ( $ 1 \le i \le 2N - 1 $ ), meaning it divides between the $ i $ -th and $ (i+1) $ -th gems from the left.
- No two or more dividers exist at the same position.
- The number of dividers $ K $ is at most $ N $ .
- Inserting $ K $ dividers divides the row of gems into $ K + 1 $ segments. Here, collecting all gems in the odd-numbered (first, third, ...) segments from the left yields exactly one gem of each type $ 1, 2, \ldots, N $ .
Output one way to insert dividers satisfying this condition. It can be proved that such a way always exists.
You are given $ T $ test cases; solve each one.
Input Format
The input is given from Standard Input in the following format:
> $ T $ $ \text{case}_1 $ $ \text{case}_2 $ $ \vdots $ $ \text{case}_T $
Each test case is given in the following format:
> $ N $ $ A_1 $ $ A_2 $ $ \ldots $ $ A_{2N} $
Output Format
Output for the $ T $ test cases in order.
For each test case, output a way to insert dividers satisfying the condition. Specifically, let $ K $ be the number of dividers and $ C_1, C_2, \ldots, C_K $ be the positions of the dividers in ascending order, and output in the following format:
> $ K $ $ C_1 $ $ C_2 $ $ \ldots $ $ C_K $
Here, $ K $ must be at most $ N $ .
Explanation/Hint
### Sample Explanation 1
For the first test case, inserting dividers at positions $ 1, 2, 4 $ divides the gems into segments $ (1),(2),(2,3),(3,1) $ , and collecting all gems in the odd-numbered segments from the left yields exactly one gem of each type $ 1, 2, 3 $ .
### Constraints
- $ 1 \le T \le 10^5 $
- $ 1 \le N \le 2 \times 10^5 $
- $ 1 \le A_i \le N $ ( $ 1 \le i \leq 2N $ )
- There are exactly two gems of each type. That is, for each $ x $ ( $ 1 \le x \le N $ ), there are exactly two indices $ i $ with $ A_i = x $ .
- The sum of $ N $ over all test cases is at most $ 2 \times 10^5 $ .
- All input values are integers.