#include using namespace std; #define all(vec) vec.begin(),vec.end() typedef long long int ll; typedef pair P; const ll MOD=1000000007; const ll INF=1000000010; const ll LINF=4000000000000000010LL; const int MAX=310; const double EPS=1e-3; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; int d[210]; struct edge{int to,cost;}; vector G[210]; int p[210]; int main(){ int n,m,s,g;cin>>n>>m>>s>>g; for(int i=0;i>a>>b>>c; G[a].push_back({b,c}); G[b].push_back({a,c}); } priority_queue,greater

> q; q.push(P(0,s)); fill(d,d+n,INF); fill(p,p+n,-1); d[s]=0; while(!q.empty()){ P pp=q.top();q.pop(); int v=pp.second; for(int i=0;id[v]+e.cost){ d[e.to]=d[v]+e.cost; p[e.to]=v; q.push(P(d[e.to],e.to)); } } } vector ans; for(int i=g;i!=s;i=p[i])ans.push_back(i); ans.push_back(s); reverse(all(ans)); for(int i=0;i