import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());

        
        int[][] graph = new int[N][N];
        for (int i=0; i<N; i++) {
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int j=0; j<N; j++) {
                graph[i][j] = Integer.parseInt(st.nextToken());
            }
        }

        boolean[] visited = new boolean[N];
        int[] min_edge = new int[N];

        Arrays.fill(min_edge, Integer.MAXVALUE);

        int now = 0;
        int count = 1; 
        for (int i=0; i<N; i++) {
            for (int j=0; j<N; j++) {
                if (graph[i][j] != 0 && !visited[j]) {
                    min_edge[j] = Math.min(min_edge[j], graph[i][j]);
                }
            }
        }
        
    }
}

        

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: