priority_queue< pair<LL,int>,vector< pair<LL,int> >,greater< pair<LL,int> > > que;
int vis[maxn];
LL dist[maxn];
void dijkstra( int s,int n ){
while( que.size() ) que.pop();
memset( dist,0x3f,sizeof(LL)*(n+1) );
dist[s] = 0;
que.push( make_pair( 0,s ) );
while( que.size() ){
int x = que.top().second;
que.pop();
if( vis[x] ) continue;
vis[x] = 1;
for( int cure = he[x];cure;cure = ne[cure] ){
int y = ver[cure];
if( vis[y] ) continue;
if( dist[y] > dist[x] + cost[cure] ){
dist[y] = dist[x] + cost[cure];
que.push( make_pair( dist[y],y ) );
}
}
}
}