i just did those operation first in which we can get two elements into its correct place and then traversed again for leftover to do operation to get an element into its correct position but this editorial is great!
https://www.codechef.com/viewsolution/32962801
@admin Sure I will But It sometimes becomes quite long discussion there as that will be platform for all the DOUBT CLEARANCE ,But what I was suggesting to provide a Short Video Description(maybe around 5-10 min) explaining the core idea of problem In Post discussion what I observed is , in
ZOOM discussion makes it quite lengthy
and so many doubts handling go along the Explanation.
A proper well explained short Video will add more information to the Editorial and new Coders.
Thanks
Hi guys, I have done this question using Graph. If anyone wants to see the implementation then please have a look at this.
can you please explain your approach. 
I was able to solve only first two problems…Can anyone suggest which problems to practice to get better?
Hi Anurag, Here is my algorithm using graph. There are 3-types of operations as follows:
1. Operations, in which all the 3 elements comes to their right positions in single operation.
2. Then those operations in which 2 elements can be placed at their right position in single operations.
3. At the end, last type of operations are those in which 1 element can be placed in right position in single operation.
Using the concept of these operations i have written the code.
completely agreed with you
https://www.codechef.com/viewsolution/32623512
here is my solution …
i was just trying to put i at its correct place, nothing much ![]()
It passed …
i dont understand this
> If the permutation is odd, it is not possible to sort it.
Can anyone pls explain.
Its got to do with the fact that even + even is always even. The operation we are allowed to do acts as an even number. If the original permutation is odd, then we can never reach the identity permutation(think of this like 0, which is even).
Before your actual code starts i.e. on the unmodified input array, just once do a cyclic shift on all the triplets that you can obtain directly viz. i, j=a[i] and k=a[a[i]]. Don’t forget to count it.
Can somebody please have a look at my code and tell me where I went wrong??
Please it would help a lot!!
https://www.codechef.com/viewsolution/32923428
and I have a doubt, assume this sequence 7 3 5 4 2 1 6
this is odd but we can still sort this!!!
An odd permutation is one that can be reached by an odd number of two-element swaps.
This is not an odd permutation since it can be reached in four swaps.
1 2 3 4 5 6 7
6 2 3 4 5 1 7
7 2 3 4 5 1 6
7 3 2 4 5 1 6
7 3 5 4 2 1 6
oh I see, can you please review my code once??
I’ve tried a lot but I can’t find where my code is failing
I can’t figure out your exact approach. Can you just brief me?
Odd permutation means it has odd number of inversions.
refer to the above question