int V, E, K; int dist[20002]; // dist[i] : minimum distance going to node i, gets updated vector< pair<int,int> > map[20002]; // connected node information : {to,value}
while(!pq.empty()) { int current_node = pq.top().second; int cost = (-1) * pq.top().first; // to use priority_queue as minimum heap pq.pop();
// update values of dist for(int i = 0; i < map[current_node].size(); i++){ int test_node = map[current_node][i].first; int new_cost = cost + map[current_node][i].second; int before_cost = dist[test_node];