#include typedef long long ll; #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define REP(i,a) FOR(i,0,a) using namespace std; const ll MAX_N=1e5,INF=1e18; ll N,M; struct edge{ ll to,cst; }; vector G[MAX_N]; ll dst[MAX_N][2]; struct st{ ll v,f; }; bool operator<(const st &a,const st &b){ return a.v P; int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>N>>M; REP(i,M){ ll a,b,c; cin>>a>>b>>c; a--; b--; G[a].push_back((edge){b,c}); G[b].push_back((edge){a,c}); } REP(v,N)REP(f,2)dst[v][f]=INF; dst[0][0]=0; priority_queue,greater

> pque; pque.push(P(0,(st){0,0})); while(!pque.empty()){ P p=pque.top(); pque.pop(); st s=p.second; if(dst[s.v][s.f]p.first+cst){ dst[e.to][f2]=p.first+cst; pque.push(P(dst[e.to][f2],(st){e.to,f2})); } } } } cout<<0<