func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 2e9;   const long long INFL = 1e18;   const int N = 3e5;   int n, m, R;   vector<int> adj[N + 5];   pair<int, int> E[2 * N + 5];   long long d[N + 5];   struct cmp {     bool operator()(pair<int, long long> x, pair<int, long long> y) {       return (x.second > y.second);     }   };   priority_queue<pair<int, long long>, vector<pair<int, long long> >, cmp> H;   int tr[N + 5];   void Dijkstra() {     for (int i = (1), _b = (n); i <= _b; ++i) d[i] = INFL;     d[R] = 0;     H.push(make_pair(R, d[R]));     while (!H.empty()) {       int u = H.top().first;       long long oldDist = H.top().second;       H.pop();       if (oldDist != d[u]) continue;       for (int i = (0), _b = (((int)(adj[u]).size())); i < _b; ++i) {         int v = E[adj[u][i]].first, w = E[adj[u][i]].second;         if (d[u] + w < d[v] ||             d[u] + w == d[v] && E[adj[u][i]].second < E[tr[v]].second) {           d[v] = d[u] + w;           H.push(make_pair(v, d[v]));           tr[v] = adj[u][i];         }       }     }   }   vector<int> pth;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n >> m;     int cntE = 0;     while (m--) {       int u, v, w;       cin >> u >> v >> w;       E[++cntE] = make_pair(v, w);       adj[u].push_back(cntE);       E[++cntE] = make_pair(u, w);       adj[v].push_back(cntE);     }     cin >> R;     Dijkstra();     long long res = 0;     for (int i = (1), _b = (n); i <= _b; ++i)       if (i != R) {         res += E[tr[i]].second;         pth.push_back(tr[i]);       }     cout << res <<   n ;     for (int i = (0), _b = (((int)(pth).size())); i < _b; ++i)       cout << (pth[i] + 1) / 2 <<    ;     cout <<   n ;     return 0;   }   