WA IN HOMEDEL

Can someone please point out the error in this code http://www.codechef.com/problems/HOMDEL/

Here is my solution: http://ideone.com/KNrzmr

I am basically using Dijkstra’s algorithm precomputing the distances for every possible source and destination node.

//