struct node
{
int v;
ll value;
node(int a, ll b):v(a),value(b){};
bool operator < (const node& no) const {
return value > no.value;
}
};
void dijkstra()
{
mem(dis,INF);
mem(vis,0);
p_queue <node> q;
dis[1] = 0;
q.push(node(1,0));
while(!q.empty())
{
node no = q.top();
q.pop();
int u = no.v;
if(vis[u]) continue;
vis[u] = 1;
for(int i = head[u] ; i != -1 ; i = edge[i].next)
{
int v = edge[i].t , w = edge[i].w;
if(dis[v] > dis[u] + w)
{
dis[v] = dis[u] + w;
q.push(node(v,dis[v]));
}
}
}
}