#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAXV 500
#define inf 0x0fffffff
typedef pair<int,int>P; //最短距离,编号
struct edge
{
int to,cost;
};
vector<edge>G[MAXV];
int d[MAXV];
class cmp
{
public:
bool operator()(pair<int,int>a,pair<int,int>b)
{
return a.first>b.first;
}
};
void dijsktra(int s)
{
priority_queue<P,vector<P>,cmp>que;
int i;
for(i=0;i<MAXV;i++)
d[i]=inf;
d[s]=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;
int i;
for(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));
}
}
}
}