Can anybody help me with my code for the problem PERMSUFF of August Cook-Off challenge.

Also tell me if i am using the correct logic or not.

I am looking for a number which remains at its position after the shuffling, and once i have the numbers

with me then i sort out the array and check whether the smallest number of that array could be shuffled

using the pair of integers.

If my logic is not correct, then please explain me a better logic.

Link : http://www.codechef.com/viewsolution/4625685