As of November 8, 2017 all submissions to the problem are available for this problem (at codechef). I just found this solution. It looks interesting, but I can't understand how it works. Can anyone please explain it to me?
P.S. I managed to solve this problem, getting 30 points
My solution: https://www.codechef.com/viewsolution/15751154
Solution I found: Solution: 16038037