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