# SPFA+优先队列维护

64bit IO Format: %lld

## 题目描述

AA的欧尼酱qwb是个考古学家，有一天qwb发现了只白白圆圆小小的木乃伊，它是个爱哭鬼却很努力。qwb想把这么可爱的小木乃伊送给
AA，于是便找上了快递姐姐，这下可让快递姐姐犯愁了，因为去往AA家的路实在太难走了（甚至有可能没有路能走到AA家），快递姐姐

## 输出描述:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int inf = 0x3f3f3f3f;
struct node{
int end;
int weight;
node(int e,int w)
{
this->end = e;
this->weight = w;
}
};
int n, m;
ll dis[maxn];
vector<node> edge[maxn];

void spfa()
{
fill(dis, dis + maxn, inf);
priority_queue<int, vector<int>, greater<int> > q;
q.push(1);
dis[1] = 0;
while(!q.empty())
{
int tmp = q.top();
q.pop();
for(int i = 0;i < edge[tmp].size();i ++)
{
int nowEnd = edge[tmp][i].end;
int nowWeight = edge[tmp][i].weight;
if(dis[nowEnd] > dis[tmp] + nowWeight)
{
dis[nowEnd] = dis[tmp] + nowWeight;
q.push(nowEnd);
}
}
}
}
int main()
{
int t1, t2, t3;
cin >> n >> m;
for(int i = 1;i <= m;i ++)
{
scanf("%d%d%d",&t1,&t2,&t3);
edge[t1].push_back(node(t2,t3));
edge[t2].push_back(node(t1,t3));
}

spfa();

if(dis[n] != inf)
cout << dis[n] << endl;
else
cout << "qwb baka" << endl;
return 0;
}