时间复杂度:O(mlongn)
void Dijkstra()
{
priority_queue<pair<int,int>>q;
memset(d,0x3f,sizeof d);
memset(v,0,sizeof v);
d[1] = 0;
q.push({0,1}); //利用小根堆
while(q.size())
{
int x = q.top().second;
q.pop();
if(v[x]) continue;
v[x] = 1;
for(int i = head[x]; i ; i = Next[i])
{
int y = ver[i];
int z = edge[i];
if(d[y] > d[x] + z)
{
d[y] = d[x] + z;
q.push({-d[y],y});
}
}
}
}