#H2025A. Arahc and an Array
Arahc and an Array
Description
Arahc has a sequence of size . He wants you to sort it in ascending order.
You can perform at most operations. In each operation, you select an index , and reverse the substrings and (If exists). For example, if the sequence is and you select , the sequence will become .
If no solution within operations exists, output .
Format
Input
The first line contains a single integer , the number of test cases. For each test case:
The first line contains a single integer , the size of the sequence.
The second line contains integers .
Output
For each test case:
If no solution within operations exists, output .
Otherwise, the first line contains a single integer , the number of operations you will perform.
The next line contains integers , where is the index you select in the -th operation.
Samples
2
6
1 4 3 5 3 2
2
2 1
5
5 3 6 2 4
-1
相关
在下列比赛中: