I have solved this problem, but I am unable to vote on it (easy/hard concept/implementation recommend/not).The voting panel does not show up.
http://www.spoj.com/problems/NPC2015D/
vote requirement->1-be spoj user for at least 5 days2- solve at least 15 problems3-solve this problem