classMain{ publicstaticvoidmain(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[][] g = newint[501][501]; int[] dist = newint[501]; boolean[] st = newboolean[501];
//初始化g for(int i = 1; i < g.length; i++){ Arrays.fill(g[i], 1000000000); }
for(int i = 1; i<= m; i++){ int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); g[a][b] = Math.min(g[a][b], c); }