#include using namespace std; typedef pair P; typedef pair> PP; typedef long long ll; const double EPS = 1e-8; const int INF = 1e9; const int MOD = 1e9+7; int dy[] = {0,1,0,-1}; int dx[] = {1,0,-1,0}; struct edge{ int to,cost; bool operator<(const edge &e)const{return to < e.to;} bool operator==(const edge &e)const{return to == e.to;} }; vector dijkstra(int s,int g,vector>&es){ priority_queue,vector

,greater

> pq; vector dist(es.size(),INF); pq.push(make_pair(0,s)); dist[s] = 0; while(!pq.empty()){ pair p = pq.top();pq.pop(); int u = p.second,d = p.first; for(int i=0;i dist[u] + c){ dist[v] = d + c; pq.push(make_pair(d+c,v)); } } } vector path; path.push_back(g); int u = g; while(s != u){ for(int i=0;i> n >> m >> s >> g; vector> es(n); for(int i=0;i> a >> b >> c; es[a].push_back(edge{b,c}); es[b].push_back(edge{a,c}); } for(int i=0;i path = dijkstra(g,s,es); for(int i=0;i