func_code_string: #include <bits/stdc++.h>   int C[100005], D[505][505], L[100005], R[100005], Par[100005];   int N, K, M;   using namespace std;   int find(int n) {     if (Par[n] == n)       return n;     else       return Par[n] = find(Par[n]);   }   void join(int a, int b) { Par[find(a)] = find(b); }   int main() {     cin >> N >> M >> K;     for (int i = 1; i <= K; i++) {       int x;       cin >> x;       L[i] = R[i - 1] + 1;       R[i] = L[i] + x - 1;       for (int p = L[i]; p <= R[i]; p++) C[p] = i;     }     for (int i = 1; i <= N; i++) Par[i] = i;     for (int i = 1; i <= K; i++) {       for (int j = 1; j <= K; j++) D[i][j] = 1000000005;       D[i][i] = 0;     }     while (M--) {       int a, b, d;       cin >> a >> b >> d;       if (d == 0) join(a, b);       D[C[a]][C[b]] = min(D[C[a]][C[b]], d);       D[C[b]][C[a]] = min(D[C[b]][C[a]], d);     }     for (int i = 1; i <= K; i++)       for (int p = L[i]; p <= R[i]; p++)         if (find(p) != find(L[i])) {           cout <<  No ;           return 0;         }     for (int k = 1; k <= K; k++)       for (int i = 1; i <= K; i++)         for (int j = 1; j <= K; j++) D[i][j] = min(D[i][j], D[i][k] + D[k][j]);     cout <<  Yes n ;     for (int i = 1; i <= K; i++) {       for (int j = 1; j <= K; j++) {         if (D[i][j] < 1000000005)           cout << D[i][j] <<    ;         else           cout <<  -1  ;       }       cout <<   n ;     }   }   