func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   bool chkmax(T &a, T b) {     return (a < b) ? a = b, 1 : 0;   }   template <typename T>   bool chkmin(T &a, T b) {     return (a > b) ? a = b, 1 : 0;   }   inline int read() {     int x = 0, fh = 1;     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) fh = -1;     for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^  0 );     return x * fh;   }   int n, m, k, K;   int mp[605][605];   int st[605];   vector<int> G[605];   int vis[605];   int mat[605];   bool dfs(int x) {     for (int v : G[x]) {       if (!vis[v]) {         vis[v] = 1;         if (!mat[v] || dfs(mat[v])) {           mat[v] = x;           return 1;         }       }     }     return 0;   }   bool check(int x) {     for (int i = (1), _end_ = (int)(n); i <= _end_; ++i) G[i].clear();     for (int i = (1), _end_ = (int)(k); i <= _end_; ++i) {       for (int j = (1), _end_ = (int)(n); j <= _end_; ++j) {         if (mp[st[i]][j] <= x) G[i].push_back(j);       }     }     int ans = 0;     memset(mat, 0, sizeof(mat));     for (int i = (1), _end_ = (int)(k); i <= _end_; ++i) {       memset(vis, 0, sizeof(vis));       if (dfs(i)) ans++;     }     return ans >= K;   }   int main() {     n = read();     m = read();     k = read();     K = read();     memset(mp, 0x3f3f3f3f, sizeof(mp));     for (int i = (1), _end_ = (int)(n); i <= _end_; ++i) mp[i][i] = 0;     for (int i = (1), _end_ = (int)(k); i <= _end_; ++i) st[i] = read();     for (int i = (1), _end_ = (int)(m); i <= _end_; ++i) {       int x = read(), y = read(), w = read();       if (chkmin(mp[x][y], w)) mp[x][y] = mp[y][x] = w;     }     for (int kk = (1), _end_ = (int)(n); kk <= _end_; ++kk) {       for (int i = (1), _end_ = (int)(n); i <= _end_; ++i) {         for (int j = (1), _end_ = (int)(n); j <= _end_; ++j) {           if (chkmin(mp[i][j], mp[i][kk] + mp[kk][j])) mp[j][i] = mp[i][j];         }       }     }     int l = 0, r = 0x3f3f3f3f;     int ans = 0x3f3f3f3f;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(mid))         ans = mid, r = mid - 1;       else         l = mid + 1;     }     if (ans == 0x3f3f3f3f)       puts( -1 );     else       printf( %d n , ans);     return 0;   }   