File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,18 @@ public A(boolean stdIO)throws FileNotFoundException{
4141 out = new PrintWriter (outputStream );
4242 }
4343
44+ final int MAX_N = 100 ;
45+ long cost [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
46+ long w [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
47+
48+
4449 void run ()throws Exception {
4550 int n = i ();
4651 int ans = 0 ;
4752
4853 out .write ("" +ans +"\n " );
4954
5055 }
51-
52- final int MAX_N = 100 ;
53- long cost [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
54- long w [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
5556
5657
5758 void clear (){
@@ -71,14 +72,13 @@ void allPairShortestPath(int n){
7172 }
7273 // order matters: k->i->j
7374 for (int k = 1 ; k <= n ; k ++){
74- for (int i = 1 ; i <= n ; i ++){
75- for (int j = 1 ; j <= n ; j ++){
76-
77- if (cost [i ][k ] + cost [k ][j ] < cost [i ][j ]){
78- cost [i ][j ] = cost [i ][k ] + cost [k ][j ];
79- }
80- }
75+ for (int i = 1 ; i <= n ; i ++){
76+ for (int j = 1 ; j <= n ; j ++){
77+ if (cost [i ][k ] + cost [k ][j ] < cost [i ][j ]){
78+ cost [i ][j ] = cost [i ][k ] + cost [k ][j ];
79+ }
8180 }
81+ }
8282 }
8383 }
8484
You can’t perform that action at this time.
0 commit comments