[Solution] Sorting Array CodeChef Solution | CodeChef Problem Solution 2022
Given an array of length .
You are allowed to perform the following operation on the array atmost times:
- Select a non-empty http://subsequence of the array and an integer ;
- Change to for all .
You have to sort the array in strictly increasing order by performing atmost operations.
It is guaranteed that we can always sort the array under given constraints.
Input Format
- The first line of input contains a single integer , denoting the number of test cases. The description of test cases follow.
Solution Click Below:- CLICK HERE
- The first line of each test case contains an integer - the length of the array.
- The second line of each test case contains space-separated integers representing the initial array .
Output Format
For each test case print lines. Here denotes the number of operations you performed to sort the array . Note that, must be less than or equal to . For each test case,
- In the first line, print , the number of operations you perform.
- Then, print lines. The and of these lines denote the operation.
To describe the operation, print two space-separated integers and on line and print space-separated integers describing subsequence on line.
Constraints
- Sum of over all test cases does not exceed .
No comments:
Post a Comment