In the general case, all you need to do is find the bijection between the current array and the desired array, and then work out the cycle structure of this bijection.
This yields the cycles that are out of place, and you add these up (which will always total the number of non-fixed elements). -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
