Whats wrong with this solution for the question "The Escape" ( a ques on dijkstra) ?

Here is my code
http://www.codechef.com/viewsolution/4559466


Here is the question link

I am implementing dijkstra via sets, Im a noob at using this algorithm. At least I can safely say that the adjacency list is correctly made… and its working for basic test cases.
I am storing the input coordinates in a vector and naming the cordinates using an index (i=0,1,2,…) and every point is connected to every other point except itself…
I get the intuition that this should give TLE, as there can be 1000 such points…
Point out my mistakes guys.
Thanks