#include<bits/stdc++.h>
using namespace std;
const int MAX_V=10000;
const int inf=0x3f3f3f3f;
struct edge{
int to,cost;
};
typedef pair<int ,int > P;
int V;
vector<edge> G[MAX_V];//定义MAX_V个vector 每个vector里面存着这个点相连的点
int d[MAX_V];//保存起始点到点的最短路值
void dijkstra(int s)
{
priority_queue<P,vector<P>,greater<P> > que;
fill(d,d+V,inf);//初始化为无穷大
d[s]=0;//将起点初始为0
que.push(P(0,s));//放入队列
while(!que.empty())//队列不空则一直放入
{
P p =que.top();que.pop();
int v=p.second;
if(d[v]<p.first) continue;//此条件的作用 是将队列中一些已经确定最短路径的值跳过
for(int i=0;i<G[v].size();i++)
{
edge e =G[v][i];
if(d[e.to]>d[v]+e.cost)
{
d[e.to]=d[v]+e.cost;//更新值
que.push(P(d[e.to],e.to));//将此点相连点放进队列
}
}
}
}