How this Solution works even if in priority queue the values stored are not weights.I think for Dijikstra to work we should maintain a priority que which give the node whose distance is shortest from the source but in this implementation the priority queue gives the smallest node number
LINK:http://mirror.codeforces.com/contest/20/submission/30960352