priority_queue returns maximum value at each point. But in Dijkstra we want to pick up the smallest possible distance every time. So, when we push the negative distance value into the priority_queue, the maximum value becomes the smallest one. Therefore, each time we can get minimum distance in top of the priority_queue.