#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1e5;
typedef long long LL;
typedef pair<int,int>P;///first最短距离,second顶点的编号
struct edge{
int to,cost;
};
vector<edge>g[maxn];
int vis[maxn];
int dis[maxn];
int n,m;
void dijkstra()
{
int s=1;///起点是1
memset(dis,0x3f,sizeof(dis));///初始化
dis[s]=0;
memset(vis,0,sizeof(vis));///初始化
priority_queue< P, vector<P> , greater<P> >que;
que.push({0,s});
while(!que.empty())
{
P p=que.top();que.pop();
int v=p.second;
if(vis[v]) continue;
vis[v]=1;
for(int i=0;i<g[v].size();i++)
{
edge e=g[v][i];
if(dis[e.to]>dis[v]+e.cost)
{
dis[e.to]=dis[v]+e.cost;
que.push({dis[e.to],e.to});
}
}
}
}