#include<stdio.h> #include<memory.h> #include<algorithm> using namespace std; int const maxN = 1000; int const INF = 1000001; int tab[maxN][maxN]; int n,m,a,b,c; void Floyd(); int main(){ scanf("%d %d\n", &n, &m); for(int i = 1; i <= n; i++){ for(int j = 1; j<= n; j++){ if(tab[i][j] == 0){ tab[i][j] = INF; } } tab[i][i] = 0; } for(int i = 0; i < m; i++){ scanf("%d %d %d", &a, &b, &c); tab[a][b] = c; tab[b][a] = c; } for(int i = 1; i <=n; i++){ for(int j = 1; j <=n;j++){ printf("z %d do %d mam%d\n", i,j,tab[i][j]); } } Floyd(); for(int i = 1; i <= n; i++){ for(int j = 1; j<= n; j++){ printf("ODL OD %d DO %d = %d\n", i,j,tab[i][j]); } } return 0; } void Floyd(){ for(int k = 1; k <=n;k++){ for(int i = 1; i <= n; i++){ for(int j = 1; j<=n; j++){ tab[i][j] = min(tab[i][j], tab[i][k] + tab[k][j]); } } } }