結果
問題 | No.1344 Typical Shortest Path Sum |
ユーザー | GER_chen |
提出日時 | 2021-01-26 11:43:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 778 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 87,008 KB |
実行使用メモリ | 78,152 KB |
最終ジャッジ日時 | 2023-09-05 15:52:53 |
合計ジャッジ時間 | 10,905 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 73 ms
71,420 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 72 ms
71,376 KB |
testcase_06 | AC | 74 ms
71,328 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 74 ms
71,336 KB |
testcase_11 | AC | 74 ms
71,144 KB |
testcase_12 | WA | - |
testcase_13 | AC | 73 ms
71,336 KB |
testcase_14 | AC | 74 ms
71,288 KB |
testcase_15 | AC | 75 ms
71,552 KB |
testcase_16 | WA | - |
testcase_17 | AC | 72 ms
71,340 KB |
testcase_18 | WA | - |
testcase_19 | AC | 73 ms
71,172 KB |
testcase_20 | AC | 74 ms
71,380 KB |
testcase_21 | AC | 73 ms
71,428 KB |
testcase_22 | AC | 73 ms
71,232 KB |
testcase_23 | WA | - |
testcase_24 | AC | 76 ms
71,260 KB |
testcase_25 | AC | 74 ms
71,032 KB |
testcase_26 | AC | 74 ms
71,032 KB |
testcase_27 | AC | 75 ms
71,332 KB |
testcase_28 | AC | 75 ms
71,264 KB |
testcase_29 | AC | 76 ms
71,252 KB |
testcase_30 | AC | 74 ms
71,380 KB |
testcase_31 | AC | 75 ms
71,040 KB |
testcase_32 | AC | 75 ms
71,332 KB |
testcase_33 | AC | 76 ms
71,180 KB |
testcase_34 | AC | 75 ms
71,460 KB |
testcase_35 | AC | 71 ms
71,172 KB |
testcase_36 | AC | 73 ms
71,164 KB |
testcase_37 | WA | - |
testcase_38 | AC | 75 ms
71,332 KB |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | AC | 73 ms
71,252 KB |
testcase_72 | AC | 74 ms
71,372 KB |
testcase_73 | AC | 74 ms
71,216 KB |
testcase_74 | AC | 75 ms
71,368 KB |
testcase_75 | WA | - |
testcase_76 | AC | 75 ms
71,328 KB |
testcase_77 | AC | 74 ms
71,364 KB |
testcase_78 | WA | - |
testcase_79 | WA | - |
ソースコード
def floyd_warshall(n, Edges): """ n: number of vertices Edges: set of edges """ sp = [[float('inf')]*n for _ in range(n)] for init, end, weight in Edges: sp[init][end] = weight #no multi edge for i in range(n): sp[i][i] = 0 for i in range(n): for j in range(n): for k in range(n): if sp[i][j] > sp[i][k]+sp[k][j]: sp[i][j] = sp[i][k]+sp[k][j] return sp N, M = map(int, input().split()) #N頂点、M辺 #辺集合 Edges = set() for _ in range(M): s, t, d = map(int, input().split()) Edges.add((s-1, t-1, d)) #到達不可能な場合0にする設定 sp = floyd_warshall(N, Edges) for i in range(N): print(sum(l if l < float('inf') else 0 for l in sp[i]))