The Grux Permutation DPERM LTIME 73A

Problem link

Please tell me where I have commited mistake in this editorial based solution
My Submission

Thanks in Advanced