#include #include #include #include using namespace std; using ll = long long; using P = pair; using P2 = pair>; using Graph = vector>>; const ll INF = 1LL<<60; int N, M; ll C; Graph G(200010); ll D_st[200010], D_en[200010][2]; void Dijkstra1(int src){ fill(&D_st[0], &D_st[0]+200010, INF); D_st[src]=0; priority_queue, greater

> Q; Q.push({0, src}); while(! Q.empty()){ auto [dist, cur] = Q.top(); Q.pop(); if (dist>D_st[cur]) continue; for (auto [dst, w]: G[cur]){ if(dist+w+C, greater> Q; Q.push({0, make_pair(src, 0)}); Q.push({0, make_pair(src, 1)}); while(! Q.empty()){ auto [dist, p] = Q.top(); Q.pop(); auto [cur, used] = p; if (dist>D_en[cur][used]) continue; for (auto [dst, w]: G[cur]){ if(used==0 && dist+C>N>>M>>C; for (int i=0;i>U>>V>>W; G[U].push_back({V, W}); G[V].push_back({U, W}); } Dijkstra1(1); Dijkstra2(N); for (int i=2;i<=N;i++){ cout << min(D_st[N], D_st[i]+D_en[i][1]) << "\n"; } return 0; }