Why does this not work:
while (!pq.empty()) { int curr=pq.top().second; int l=pq.top().first; pq.pop(); if (curr==n-1) break; for (auto a: adj[cur