#include using namespace std; #define all(v) v.begin(),v.end() using ll = long long; using ull = unsigned long long; using vll=vector; using vvll = vector>; const ll INF=1ll<<60; using P = pair; int main(){ ll N,M; cin>>N>>M; vector> ab(N); for(int i=0;i>a>>b>>c; a--;b--; ab[a].push_back({c,b}); ab[b].push_back({c,a}); } ll l=0,r=1e16; while(r-l>1){ ll m=(r+l)/2; vector dist(N,INF); priority_queue,greater

> q; q.push({0,0}); dist[0]=0; while(!q.empty()){ auto x=q.top();q.pop(); ll cost=x.first,now=x.second; if(dist[now] dist(N,INF); priority_queue,greater

> q; q.push({0,0}); dist[0]=0; while(!q.empty()){ auto x=q.top();q.pop(); ll cost=x.first,now=x.second; if(dist[now]