#include using namespace std; #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} int main(){ int n,m,k; cin>>n>>m>>k; using P=pair; vector g(n,vector

()); rep(_,0,m){ int x,y,c; cin>>x>>y>>c; x--; y--; g[x].push_back({y,c}); g[y].push_back({x,c}); } int L=0,R=201010; while(R-L>1){ int mid=(L+R)>>1; vector h(n,vector

()); rep(i,0,n)for(auto& [to,c]:g[i]){ if(c dist(n,inf); dist[0]=0; priority_queue,greater

> pq; pq.push({0,0}); while(!pq.empty()){ auto [d,v]=pq.top(); pq.pop(); if(dist[v]!=d)continue; for(auto& [to,c]:h[v])if(chmin(dist[to],d+c)){ pq.push({dist[to],to}); } } if(dist[n-1]<=k-1)R=mid; else L=mid; } cout<